Professional Documents
Culture Documents
Dr. Akhilesh Das Gupta Institute of Technology & Management: Mobile Computing Lab ETEC - 454
Dr. Akhilesh Das Gupta Institute of Technology & Management: Mobile Computing Lab ETEC - 454
3. Program to implement WML deck with two cards - one for user input
and one for displaying the result.
12. Program to implement href tag to navigate from one card to other
Instructions for Laboratory Teachers
1. Submission related to whatever lab work has been completed should be done during the
next lab session.
2. The immediate arrangements for printouts related to submission on the day of practical
assignments.
3. Students should be taught for taking the printouts under the observation of lab teacher.
OBJECTIVE: To learn WAP proof software and display message using WML.
THEORY:
What is WAP?
The wireless industry came up with the idea of WAP. The point of this standard was to show
internet contents on wireless clients, like mobile phones.
What is WML?
WML stands for Wireless Markup Language. It is a mark-up language inherited from HTML, but
WML is based on XML, so it is much stricter than HTML.
WML is used to create pages that can be displayed in a WAP browser. Pages in WML are called
DECKS.
What is WMLScript?
WML uses WMLScript to run simple code on the client. WMLScript is a light JavaScript language.
However, WML scripts are not embedded in the WML pages. WML pages only contains
references to script URLs. WML scripts need to be compiled into byte code on a server before
they can run in a WAP browser.
WAP BASICS
WAP Homepages
WAP homepages are not very different from HTML homepages. The markup language used for
WAP is WML (Wireless Markup Language). WML uses tags - just like HTML - but the syntax is
stricter and conforms to the XML 1.0 standard.
WML pages have the extension *.WML, just like HTML pages have the extension *.HTML.
WML Tags
WML is mostly about text. Tags that would slow down the communication with handheld devices
are not a part of the WML standard. The use of tables and images is strongly restricted.
Since WML is an XML application, all tags are case sensitive (<wml> is not the same as <WML>),
and all tags must be properly closed.
WML pages are called DECKS. They are constructed as a set of CARDS, related to each other
with links. When a WML page is accessed from a mobile phone, all the cards in the page are
downloaded from the WAP server. Navigation between the cards is done by the phone computer
- inside the phone - without any extra access trips to the server.
PROGRAM:
<wml>
<p>Hello World!</p>
</card>
</wml>
Result:
Conclusion: Hence we have studied WAP proof software and WML program to display a
message.
EXPERIMENT No. 2
AIM: Program to implement WML program to display images.
THEORY:
The <img> element is used to include an image in a WAP card. WAP-enabled wireless devices
only supported the Wireless Bitmap (WBMP) image format.
WBMP images can only contain two colors: black and white. The file extension of WBMP is
".wbmp" and the MIME type of WBMP is "image/vnd.wap.wbmp".
hspace Sets white space to the left and right of the image.
px
If you specify the value in pixels, the syntax is
% "140", instead of "140px".
PROGRAM:
<wml>
<card title="Image">
<p>
This is an image
in a paragraph
</p>
</card>
</wml>
Result:
THEORY:
The Deck
<wml> ......</wml>
The deck is the WML document itself. It is embedded within <wml> tags
The Cards
<card>...... </card>
Cards are always displayed one at the time. This WML deck contains two cards - one for user input
and one for displaying the result.
The first card has a <do> element that defines an event to be triggered. The type="accept"attribute
of the <do> element causes the label="Answer" to be displayed in the lower left corner of the
display.
The Event
The <go> element triggers when the user clicks the <do> label. The href="#card2" attribute of the
<go> element causes card2 to be displayed on the screen.
PROGRAM:
<wml>
< go href="#card2"/>
</do>
<p><select name="name">
</select></p>
</card>
</card>
</wml>
Result:
Conclusion: Hence we have implemented WML program to display image.
EXPERIMENT NO. 4
AIM: A WML Card can be set up to display the fieldset fuction of wml.
THEORY:
The <fieldset/> element is used to group various input fields or selectable lists.
Attributes:
PROGRAM:
<wml>
< card title="Input">
<p>
</p>
</card>
</wml>
Result:
THEORY:
The <pre> element is used to specify preformatted text in WML. Preformatted text is text of which
the format follows the way it is typed in the WML document.
This tag preserves all the white spaces enclosed inside this tag. Make sure you are not putting this
tag inside <p>...</p>
WML does not support <font> element, but there are other WML elements, which you can use to
create different font effects like underlined text, bold text and italic text, etc.
PROGRAM:
<wml>
<card title="Formatting">
<p>
normal<br/>
<em>emphasized</em><br/>
<strong>strong</strong><br/>
<b>bold</b><br/>
<i>italic</i><br/>
<u>underline</u><br/>
<big>big</big><br/>
<small>small</small><br/>
</p>
</card>
</wml>
Result:
THEORY:
The <table> element along with <tr> and <td> is used to create a table in WML. WML does not
allow the nesting of tables
<wml>
<card title="Table">
<p>
<table columns="3">
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
</tr>
</table>
</p>
</card>
</wml>
Result:
THEORY:
The <br /> element defines a line break and almost all WAP browsers supports a line break
tag.
PROGRAM:
<wml>
<card title="Paragraphs">
<p>
This is a paragraph
</p>
<p>
</p>
/card>
</wml>
Result:
THEORY:
The <input/> element is used to create input fields and input fields are used to obtain
alphanumeric data from users.
name text The name of the variable that is set with the
result of the user's input
emptyok Sets whether the user can leave the input field
true
blank or not. Default is "false"
false
format A Sets the data format for the input field. Default
a is "*M".
N
X A = uppercase alphabetic or punctuation
x
characters
M
a = lowercase alphabetic or punctuation
m
characters
*f
nf N = numeric characters
X = uppercase characters
x = lowercase characters
M = all characters
m = all characters
*f = Any number of characters. Replace
the fwith one of the letters above to specify
what characters the user can enter
nf = Replace the n with a number from 1 to 9
to specify the number of characters the user
can enter. Replace the f with one of the letters
above to specify what characters the user can
enter
tabindex number Sets the tabbing position for the select element
<wml>
<card title="Input">
<p>
</p>
</card>
</wml>
Result:
THEORY:
The <select>...</select> WML elements are used to define a selection list and the
<option>...</option> tags are used to define an item in a selection list. Items are presented as
radiobuttons in some WAP browsers. The <option>...</option> tag pair should be enclosed
within the <select>...</select> tags.
iname text Names the variable that is set with the index result
of the selection
name text Names the variable that is set with the result of the
selection
tabindex number Sets the tabbing position for the select element
<wml>
<p>
</select>
</p>
</card>
</wml>
Result:
THEORY:
The <select>...</select> WML elements are used to define a selection list and the
<option>...</option> tags are used to define an item in a selection list. Items are presented as
radio buttons in some WAP browsers. The
<option>...</option> tag pair should be enclosed within the
<select>...</select> tags.
This element support the following attributes:
iname text Names the variable that is set with the index result
of the selection
name text Names the variable that is set with the result of the
selection
tabindex number Sets the tabbing position for the select element
value text Sets the default value of the variable in the "name"
attribute
<wml>
<p>
<select name="name">
</select>
</p>
</card>
Result:
THEORY:
A timer is declared inside a WML card with the <timer> element. It must follow the <onevent>
elements if they are present. (If there are no <onevent> elements, the <timer> must be the first
element inside the <card>.) No more than one <timer> may be present in a card.
value number Specifies the timer after which timer will be expired.
Timeouts are specified in units of a tenth of a second.
PROGRAM:
<wml>
<card ontimer="a.wml">
<timer value="30"/>
<p>Some Message</p>
</card>
</wml>
Result:
THEORY:
The <anchor>...</anchor> tag pair is used to create an anchor link. It is used together with other
WML elements called <go/>, <refresh> or <prev/>. These elements are called task elements
and tell WAP browsers what to do when a user selects the anchor link
You can enclose Text or image along with a task tag inside <anchor>...</anchor> tag pair.
The <a>...</a> tag pair can also be used to create an anchor link and always a preferred way
of creating links.
As the name suggests, the <go> task represents the action of going to a new card.
href URL Gives the URL of the new card. Relative URLs are
resolved relative to the current card
PROGRAM:
<wml>
<go href="#thirdcard"/>
</do>
<p>
</p>
</card>
<p>
</p>
</card>
<p>
</p>
</card>
</p>
</card>
</wml>
Result: