Вы находитесь на странице: 1из 48

BT 0091 WML and WAP Programming Practical Contents

Guidelines for Conducting Practical Exercises Exercise 1 Installation, Configuration and Execution of WAP Toolkit Exercise 2 Hello World Example Exercise 3 Paragraphs and Line Breaks Exercise 4 Text Formatting Exercise 5 WML Tables Exercise 6 Links Exercise 7 WML Events (onenterbackward) Exercise 8 WML Selection Lists Exercise 9 WML Events (onpick)
BKID B1184 25 May 2010
th

i-iv 1 5 7 8 9 11 14 18 19

Exercise 10 WML Password Input Fields Exercise 11 Reset Buttons in WML Exercise 12 Referencing and Setting Variables Exercise 13 Task Shadowing / Inter-deck Navigation

22 23 26 32

Acknowledgements, References & Suggested Readings 36 Model Question Paper 37

Dean Directorate of Distance Education Sikkim Manipal University (SMU DDE) Board of Studies Chairman Head IT SMU DDE, Manipal 576 104 Additional Registrar SMU DDE Manipal 576104 Addl. Registrar (S.E) Office of the Student Evaluation Manipal 576 104 Prof. Bhushan Patwardhan Chief Academics Manipal Education, Bangalore Dr. Harishchandra Hebbar Director Manipal Centre for Info. Sciences, Manipal. Dr. N. V. Subba Reddy HOD-CSE Manipal Institute of Technology Manipal 576 104 Dr. Ramprasad Varadachar Director, Computer Studies Dayanand Sagar College of Engg. Bangalore Content Preparation Team Content Writing Mr. Balasubramani R. Assistant Professor, Dept. of IT Sikkim Manipal University DDE Manipal. Instructional Design Mr. Kulwinder Pal Assistant Professor Education Sikkim Manipal University DDE Manipal. Edition: Spring 2009 Printed: May 2010 This book is a distance education module comprising a collection of learning material for our students. All rights reserved. No part of this work may be reproduced in any form by any means without permission in writing from Sikkim Manipal University, Gangtok, Sikkim. Printed and published on behalf of Sikkim Manipal University, Gangtok, Sikkim by Mr.Rajkumar Mascreen, GM, Manipal Universal Learning Pvt. Ltd., Manipal 576 104. Printed at Manipal Press Limited, Manipal. Mr. Nirmal Kumar Nigam HOP- IT SMU DDE, Manipal 576 104 Dr. A. Kumaran Research Manager (Multilingual) Microsoft Research Labs India Bangalore. Mr. P. S. Ravindranath Director (Quality) Yahoo India, Bangalore. Dr. Ashok Kallarakkal Vice President IBM India, Bangalore. Mr. H. Hiriyannaiah Group Manager EDS Mphasis, Bangalore. Dr. Ashok Hegde Vice President MindTree Consulting Ltd., Bangalore

Content Editing Mr. Purushotham U Sr. Lecturer, Dept. of IT Sikkim Manipal University DDE Manipal. Language Editing Ms. Aparna Ramanan Assistant Professor English Sikkim Manipal University - DDE Manipal.

SUBJECT INTRODUCTION
The subject titled WML and WAP Programming Practical bearing the subject code BT 0091 is a two credit subject of fifth semester in BSc IT program, and it is a complementary subject to the WML and WAP Programming Theory bearing the subject code BT 0087. The WAP (Wireless Application Protocol) is the leading standard for information services on wireless terminals like digital mobile phones. WML (Wireless Markup Language) is the language used to create pages to be displayed in a WAP browser. As mobile phones become more widespread and powerful, the demand for Internet access on the move grows rapidly. WAP is the standard that makes mobile Internet access possible. It specifies the protocol stack and application environment of mobile Internet browsing applications. WML is the markup language defined in the WAP 1.x specification. It is the first industry-wide wireless markup language standard. There were several markup languages in the wireless world before the coming out of WML. WML documents can be viewed on both WAP 1.x and WAP 2.0 wireless devices. So, by using WML, your WAP site can be visited by most of the wireless devices in the world. This lab manual intends you to gain experience in WML and WAP Programming starting from basics to the advanced concepts like using events. It helps you to develop your programming skills. You would be taken through all the concepts explained theoretically in the book to practical implementation and application of the same. You would be familiarized with the working environment of WAP and hence, be able to develop the programs. The manual starts with introductory WML programming and tries to cover all the WML elements, WML forms and variables. It also covers some advanced concepts. This lab manual is prepared with an intention of increasing the comfort level of students in WML and WAP Programming.

The following subjects deal with the theoretical aspects and sample exercises for reference. 1. BT0087 WML and WAP Programming Theory IV Semester 2. BT0072 Computer Networks I Semester 3. BT0078 Website Design II Semester Objectives The objective of this manual is to make you to get hands on experience in the application of theoretical concepts learnt in this semester. It covers Wireless Markup Language (WML) and Wireless Application Protocol (WAP) programming concepts. The set of experiments included as part of this lab manual intends to make you more practical oriented and also to pave the way for using WML for developing WAP applications. The manual provides you with the following details regarding the experiments to be completed: 1. Software installation and configuration 2. Problem Statement 3. Algorithm 4. WML Code 5. Output The time required by you to complete each and every experiment is also mentioned against the experiment. The format for preparation and submission of the experiments at the Learning Centers would be as follows and it should be placed as the Table of Contents page in the Record Note Book. After completing various practical exercises of this subject, you should be able to: illustrate the usage, configuration and deployment of WAP Toolkit, implement various WML text formatting tools, design tables in WML, explain the usage of various WML events, read password inputs from WML forms and process them, use reset buttons in WML, illustrate the usage of variables in WML.

Software and Hardware Requirements The following are the software and hardware requirements for performing the given exercises. Software Requirements Nokia Wap Toolkit 2.0 Java Runtime Environment 1.2.2 or later Hardware Requirements 1. P-IV or higher system 2. 80 GB Hard Disk 3. 512 MB RAM (Recommended 1GB for optimal performance)

WML and WAP Programming Practical

Exercise 1

Exercise 1

Installation, Configuration and Execution of WAP Toolkit

Objective: After undertaking this exercise, you should be able to install, configure and execute Nokia WAP Tookit on your local machine. Procedure: The steps below are a walkthrough of the deployment of required software, which would in turn be useful for completing the rest of the exercises in this practical subject. Step 1: Connect your computer to the Internet. You can view local WML and WML Script files using the Toolkit application. To use resources outside your local network, you must have an Internet connection. Step 2: Make sure you have installed Java Runtime Environment 1.2.2 or later. Step 3: From the start menu, select Programs Nokia Wap Toolkit 2.0 Wap Toolkit. Note: Windows NT sets the PATH variable in a different area than Windows 95 and Windows 98. If you are running the Nokia WAP Toolkit on a Windows 95 or Windows 98 system and want to start from command line, you must set the java.exe in your PATH variable.

Sikkim Manipal University DDE

Page No. 1

WML and WAP Programming Practical

Exercise 1

The Nokia WAP Toolkit window appears as shown in Figure 1.1.

Fig. 1.1: Nokia WAP Toolkit window with Blueprint Phone

Using Views When the Toolkit is launched, its main window displays seven tabs, each of which opens a different view into Toolkit functions and features. These tabs can be removed or added to the main window by using the Tookit Show command on the menu bar. This command also controls whether or not the mobile phone simulation (WAP Device) is displayed. In addition, whenever you create a new file or open an existing file (via File New and File Open), a new view with an accompanying tab is created. Configuring the Phone Simulations This section describes how to configure the Toolkit phone simulations based on your preferences and network infrastructure constraints. The Toolkit provides two phone simulations: the Nokia 7110, which is a real Nokia product, and the Blueprint phone, which is a generic simulation.
Sikkim Manipal University DDE Page No. 2

WML and WAP Programming Practical

Exercise 1

Fig. 1.2: Phone Simulation Configurations

Above figure depicts the three major configurations, labelled Method 1, Method 2 and Method 3. In Method 1, the phone simulation is configured to display WAP content (compiled WML, WML Script, SI, or SL), retrieved from local disk storage or from the Internet, through either a WAP server Simulator (provided in the Toolkit). Either the Nokia 7110 or the Blueprint phone simulation may be configured in this manner. In Method 2, the phone simulation is configured to display WAP content (compiled WML, WML Script, SI, or SL), retrieved through the HTTP protocol from a Web origin server, serving un-encoded, that is noncompiled, WML. The Toolkit encodes the textural HTTP content and displays the encoded content on the phone display. Only the Blueprint phone may be configured in this manner.
Sikkim Manipal University DDE Page No. 3

WML and WAP Programming Practical

Exercise 1

In Method 3, the phone simulation is configured to display WAP content (compiled WML, WML Script, SI, or SL), retrieved through the HTTP protocol from a Web origin server, serving un-encoded, that is non-compiled, WML. However, this content first passes all through an HTTP Proxy Server. The Toolkit encodes the textual HTTP content and displays the encoded content on the phone display. Only the Blueprint phone may be configured in this manner. Differences between Phone Simulations The Nokia 7110 is capable of being configured using Method 1 only as depicted in Figure 1.1, that is, it can be configured to use a WAP Gateway or to use the Toolkit WAP Server Simulator, either of which is capable of retrieving, and then encoding, WML content from local storage or (via HTTP requests) from an Origin Server on the Internet. The Toolkit Blueprint phone simulation is capable of being configured to use Methods 1, 2, or 3. Essentially, the Blueprint phone has the additional capability of making HTTP requests to an origin server without using a WAP Gateway as an intermediary (Methods 2 and 3). Whether to choose Method 2 or 3 with the Blueprint phone depends simply upon your network infrastructure. If you have to use a Proxy Server to access the Internet, then you must use Method 3, if not, then you must choose Method 2. Since the purpose of the Toolkit is to help you develop WAP applications that work over a WAP Gateway, configuring the phone to use a Gateway (or the WAP Server Simulator) is basically standard procedure. The capability of configuring using Methods 2 and 3, by-passing the WAP Gateway, is provided to enable you to debug problems with your applications. For example, if you encounter a problem and are unsure as to whether the problem lies in your application code or in the WAP Gateway itself, you could configure the Blueprint phone to use Methods 2 or 3 and then retest. If the problem disappears, then you might assume the problem is with the WAP Gateway, since you by-passed it in the new configuration. If not, the problem is likely to lie in your application.

Sikkim Manipal University DDE

Page No. 4

WML and WAP Programming Practical

Exercise 2

Exercise 2

Hello World Example

Objective: This exercise is intended to display the string message Hello World in the WAP emulator. Procedure: Type the code given below in the emulator and execute. <?xml version = 1.0?> <!DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.3//EN http://www.wapforum.org/DTD/wml13.dtd> <wml> <card id=card1 title=WML Tutorial> <p>Hello World</p> </card> <card id=card2 title=WML Tutorial> <p>Welcome to the world of WML</p> </card> </wml> Note: A major difference between HTML and WML is that the basic unit of navigation in HTML is a page, while in WML, it is a card. A WML file can contain multiple cards and they form a deck. When a user goes to a WAP site, the mobile browser loads a WML file that contains a deck of cards from the server. Only one card will be shown on the screen of the wireless device each time. If the user goes to another card of the same deck, the mobile browser does not have to send any request to the server since the file that contains the deck is already stored in the wireless device. WML is designed in this way because wireless devices have a high latency for connecting to the server. Downloading a deck of cards at a time can lower the number of round trips to the server. You can put links, text, images, input fields, option boxes and many other elements in a card. You can see the outputs in the mobile phone emulators.

Sikkim Manipal University DDE

Page No. 5

WML and WAP Programming Practical

Exercise 2

Sample Output:

Sikkim Manipal University DDE

Page No. 6

WML and WAP Programming Practical

Exercise 3

Exercise 3

Paragraphs and Line Breaks

Objective: After undertaking this exercise, you should be able to format the paragraphs and use line breaks. Procedure: Type the code given below in the emulator and execute. <?xml version = 1.0?> <!DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.1//EN http://www.wapforum.org/DTD/wml_1.1.xml> <wml> <card title=Paragraphs> <p> This is a paragraph </p> <p> This is another<br/>with a line break </p> </card> </wml> Sample Output:
Paragraphs This is a paragraph This is another with a line break

Option

Back

Sikkim Manipal University DDE

Page No. 7

WML and WAP Programming Practical

Exercise 4

Exercise 4

Text Formatting

Objective: After undertaking this exercise, you should be able to use various text formatting tags. Procedure: Type the code given below in the emulator and execute. <?xml version=1.0?> <!DOCTYPE wml PUBLIC -//WAPFORUM//DTDWML 1.1//EN http://www.wapforum.org/DTD/wml_1.1.xml> <wml> <card title=Formatting> <p> Normal<br/> <em>emphasized</em><br/> <srong>strong</strong><br/> <b>bold</b><br/> <i>italic</i><br/> <u>underline</u><br/> <big>big</big><br/> <small>small</small> </p> </card> </wml> Sample Output:

Sikkim Manipal University DDE

Page No. 8

WML and WAP Programming Practical

Exercise 5

Exercise 5

WML Tables

Objective: After undertaking this exercise, you should be able to design tables using WML. Procedure: Type the code given below in the emulator and execute. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" http://www.wapforum.org/DTD/wml13.dtd > <wml> <card id="page1" title="Table in WML"> <p> <table columns="3" align="LCR"> <tr> <td>Col 1</td> <td>Col 2</td> <td>Col 3</td> </tr> <tr> <td>A</td> <td>B</td> <td>C</td> </tr> <tr> <td>D</td> <td>E</td> <td>F</td> </tr> </table> </p> </card> </wml>

Sikkim Manipal University DDE

Page No. 9

WML and WAP Programming Practical

Exercise 5

Sample Output:

Sikkim Manipal University DDE

Page No. 10

WML and WAP Programming Practical

Exercise 6

Exercise 6

Links

Objective: After undertaking this exercise, you should be able to create links in WML. Procedure: Type the code given below in the emulator and execute. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="tutorial_ch1" title="WML Tutorial Ch1"> <p> <em>Chapter 1: WML Introduction</em><br/><br/> ...<br/><br/> <anchor> <go href="#tutorial_ch2"/> Next chapter: WML Deck and Card </anchor> </p> </card> <card id="tutorial_ch2" title="WML Tutorial Ch2"> <p> <em>Chapter 2: WML Deck and Card</em><br/><br/> ...<br/><br/> <anchor> <go href="#tutorial_ch3"/> Next chapter: WML Document Structure </anchor> </p> </card> <card id="tutorial_ch3" title="WML Tutorial Ch3"> <p> <em>Chapter 3: WML Document Structure</em><br/><br/>
Sikkim Manipal University DDE Page No. 11

WML and WAP Programming Practical

Exercise 6

...<br/><br/> <anchor> <go href="#tutorial_ch4"/> Next chapter: WML Generic Metadata </anchor> </p> </card> <card id="tutorial_ch4" title="WML Tutorial Ch4"> <p> <em>Chapter 4: WML Generic Metadata</em><br/><br/> ...<br/><br/> <anchor> <go href="#tutorial_ch1"/> Back to chapter 1: WML Introduction </anchor> </p> </card> </wml>

Sample Output:

Sikkim Manipal University DDE

Page No. 12

WML and WAP Programming Practical

Exercise 6

If you select the "Next chapter: WML Deck and Card" anchor link in the above card, the WAP browser will display the next card (card ID: tutorial_ch2) in the current deck, like this:

Sikkim Manipal University DDE

Page No. 13

WML and WAP Programming Practical

Exercise 7

Exercise 7

WML Events (onenterbackward)

Objective: After undertaking this exercise, you should be able to use WML events. Procedure: Type the code given below in the emulator and execute. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="tutorial_tc" title="WML Tutorial"> <p> Hello, welcome to our WML tutorial.<br/><br/> Table of Contents:<br/> <a href="#tutorial_ch1_ad">Chapter 1: WML Introduction</a><br/> <a href="#tutorial_ch2_ad">Chapter 2: WML Deck and Card</a><br/><br/> ... </p> </card> <card id="tutorial_ch1_ad" title="Advertisement"> <onevent type="onenterbackward"> <prev/> </onevent> <onevent type="ontimer"> <go href="#tutorial_ch1"/> </onevent> <timer value="30"/> <p> <a href="http://12345site.com/">Click here to download our free ringtones, wallpapers, mobile games and MP3 songs now.</a><br/><br/> <a href="#tutorial_ch1">Skip</a> </p> </card> <card id="tutorial_ch2_ad" title="Advertisement"> <onevent type="onenterbackward">
Sikkim Manipal University DDE Page No. 14

WML and WAP Programming Practical

Exercise 7

<prev/> </onevent> <onevent type="ontimer"> <go href="#tutorial_ch2"/> </onevent> <timer value="30"/> <p> <a href="http://67890site.com/">Click here to buy WAP-enabled cell phones online now. Free shipping.</a><br/><br/> <a href="#tutorial_ch2">Skip</a> </p> </card> <card id="tutorial_ch1" title="WML Tutorial Ch1"> <p> <em>Chapter 1: WML Introduction</em><br/><br/> ...<br/> <anchor> <prev/> Go Back </anchor> </p> </card> <card id="tutorial_ch2" title="WML Tutorial Ch2"> <p> <em>Chapter 2: WML Deck and Card</em><br/><br/> ...<br/> <anchor> <prev/> Go Back </anchor> </p> </card> </wml>

Sikkim Manipal University DDE

Page No. 15

WML and WAP Programming Practical

Exercise 7

Sample Output: Below are the screenshots of the first card in some mobile phone browsers.

If you select the "Chapter 1: WML Introduction" anchor link, you will see an advertisement in the mobile phone browser, like this:

If you do not select the "Skip" anchor link, the mobile phone browser will display Chapter 1 of the tutorial automatically after 3 seconds:

Sikkim Manipal University DDE

Page No. 16

WML and WAP Programming Practical

Exercise 7

If you select the "Go Back" anchor link, the onenterbackward event will be triggered when the advertisement card is loaded. The WML code associated with the onenterbackward event, that is <prev/>, will be executed. So, the mobile phone browser will go backwards once more and you will see the table of contents instead of the advertisement.

Sikkim Manipal University DDE

Page No. 17

WML and WAP Programming Practical

Exercise 8

Exercise 8

WML Selection Lists

Objective: After undertaking this exercise, you should be able to use WML selection lists. Procedure: Type the code given below in the emulator and execute. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="card1" title="Selection List"> <p> This is a selection list:<br/> <select name="selection_list" multiple="true"> <option value="tutorial_A">WML Tutorial A</option> <option value="tutorial_B">WML Tutorial B</option> <option value="tutorial_C">WML Tutorial C</option> </select> </p> </card> </wml> Sample Output: The result of the above WML code in some mobile phone browsers is shown below:

Sikkim Manipal University DDE

Page No. 18

WML and WAP Programming Practical

Exercise 9

Exercise 9

WML Events (onpick)

Objective: After undertaking this exercise, you should be able to use WML events. Procedure: Type the code given below in the emulator and execute. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="tutorial_tc" title="WML Tutorial"> <p> Hello, welcome to our WML tutorial.<br/><br/> Table of Contents:<br/> <select name="selection_list"> <option onpick="#tutorial_ch1">Chapter 1</option> <option onpick="#tutorial_ch2">Chapter 2</option> <option> <onevent type="onpick"> <go href="#tutorial_ch3"/> </onevent> Chapter 3 </option> <option> <onevent type="onpick"> <go href="#tutorial_ch4"/> </onevent> Chapter 4 </option> </select> </p> </card> <card id="tutorial_ch1" title="WML Tutorial Ch1"> <p> <em>Chapter 1: WML Introduction</em><br/><br/>
Sikkim Manipal University DDE Page No. 19

WML and WAP Programming Practical

Exercise 9

... </p> </card> <card id="tutorial_ch2" title="WML Tutorial Ch2"> <p> <em>Chapter 2: WML Deck and Card</em><br/><br/> ... </p> </card> <card id="tutorial_ch3" title="WML Tutorial Ch3"> <p> <em>Chapter 3: WML Document Structure</em><br/><br/> ... </p> </card> <card id="tutorial_ch4" title="WML Tutorial Ch4"> <p> <em>Chapter 4: WML Generic Metadata</em><br/><br/> ... </p> </card> </wml> Sample Output: In the above WML example, we make use of the onpick event to create a selection list that can be used to navigate between cards. The following screenshots show the result of the above WML example in some mobile phone browsers:

Sikkim Manipal University DDE

Page No. 20

WML and WAP Programming Practical

Exercise 9

If you select the selection list, the mobile phone browser will show the options available:

If you select any of the above options, the <go> task associated with the onpick event of that option will be performed and the mobile phone browser will show the chapter you have chosen. For example, if you select "Chapter 2" option, the mobile phone browser will display the card with ID tutorial_ch2 on the screen, like this:

Sikkim Manipal University DDE

Page No. 21

WML and WAP Programming Practical

Exercise 10

Exercise 10

WML Password Input Fields

Objective: After undertaking this exercise, you should be able to use WML password input fields. Procedure: Type the code given below in the emulator and execute. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="card1" title="Password Input Fields"> <p> Please login before reading our WML tutorial.<br/><br/> User Name: <input type="text" name="name" maxlength="16" value="Jack"/><br/> Password: <input type="password" name="passwd" maxlength="10" value="abc"/> </p> </card> </wml> Sample Output: The result of the above WML example in WAP browsers is shown below:

Sikkim Manipal University DDE

Page No. 22

WML and WAP Programming Practical

Exercise 11

Exercise 11

Reset Buttons in WML

Objective: After undertaking this exercise, you should be able to use WML reset buttons. Procedure: Type the code given below in the emulator and execute. <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> <card id="card1" title="WML Form"> <p> User name:<br/> <input name="myUserName"/><br/> Password:<br/> <input name="myPassword" type="password"/><br/><br/> <anchor> <go method="get" href="resetButtonsProc.asp"> <postfield name="name" value="$(myUserName)"/> <postfield name="password" value="$(myPassword)"/> </go> Submit Data </anchor><br/> <anchor> <refresh> <setvar name="myUserName" value=""/> <setvar name="myPassword" value=""/> </refresh> Reset Form </anchor> </p> </card> </wml>

Sikkim Manipal University DDE

Page No. 23

WML and WAP Programming Practical

Exercise 11

Sample Output:

The result of the above WML example in some mobile phone browsers is shown below:

Enter something in the input fields, like this:

Sikkim Manipal University DDE

Page No. 24

WML and WAP Programming Practical

Exercise 11

If you click the "Reset Form" anchor link, the input fields will be reset to their default values.

Sikkim Manipal University DDE

Page No. 25

WML and WAP Programming Practical

Exercise 12

Exercise 12

Referencing and Setting Variables

Objective: After undertaking this exercise, you should be able to use the following WML elements. card do go prev setvar onevent refresh Also you will be able to use the following attribute: newcontext Procedure: Type the code given below in the emulator and execute. <! --deck1.wml--> <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1 // EN" http://www.wapforum.org/DTD/wmI1_1.1.xml> <wml> <card id="card1" title "First Card" newcontext="true"> <p> Card 1... <br/> <! The following variables will not be defined until the other cards in this deck are entered. --> card1 var1 = $(card1_var1) <br/> card2 var1 = $(card2_var1) <br/> card3 var1 = $(card3_var1) <br/> <do type="accept label="Next Card"> <go href="#card2"> <setvar name="card1_var1" value="vaI1_1"/> </go> </do> </p> </card>
Sikkim Manipal University DDE Page No. 26

WML and WAP Programming Practical

Exercise 12

<card id="card2" title="Second Card"> <p> Card2 ...<br/> Card1 var1 = $(card1_var1) <br/> Card2 var1 = $(card2_var1) <br/> Card3 var1 = $(card3_var1) <br/> <do type="accept" label="First Card"> <go href="#card1"/> </do> <do type="accept" label="Third Card"> <go href="#card3"> <setvar name="card2_var1" value="val_2"/> </go> </do> <do type="prev" label="Previous Card"> <prev/> </do> </p> </card> <card id="card3" title="Third Card"> <p> <onevent type="onenterforward"> <refresh> <setvar name="card3_var1 " value="val_3"/> </refresh> </onevent> </p> Card 3 ...<br/> Card1 var1 = $(Card1_var1 ) <br/> Card2 var1 = $(Card2_var1) <br/> Card3 var1 = $(card3_var1) <br/> <do type="prev" label="Previous"> <prev/> </do> </p> </card></wml>
Sikkim Manipal University DDE Page No. 27

WML and WAP Programming Practical

Exercise 12

Sample Output: In the user agent, this example generates the following user interface when you enter the deck (you may need to scroll down to see the entire screen, as shown in this example on a 6150 model phone):

------- First Card ------card 1 ... card 1 var 1 = card 2 var 1 = Options

------- First Card ------card 1 var 1 = card 2 var1 = Card 3 var 1 = Options

WEBCOM PHONE
Note that none of the variables has a value at this stage.

Sikkim Manipal University DDE

Page No. 28

WML and WAP Programming Practical

Exercise 12

By pressing the Options button, you can select the Next Card.

----- Browser Options ----Next Card

Select

Back

WEBCOM PHONE

Press the Select button to choose the Next Card and go to the second card of the deck.

------- Second Card ------card 2 ... card 1 var1=val_1 card 2 var 1 = Options Back

WEBCOM PHONE

Sikkim Manipal University DDE

Page No. 29

WML and WAP Programming Practical

Exercise 12

------- Second Card ------card 1 var 1=val_1 card 2 var1= card 3 var 1 = Options Back

Note that now the variable card1 var1 has the value val_1 but the other two variables do not have values yet. Pressing Options sends you to the options card specified by the doelements in card2:

----- Browser Options ----First Card Third Card Select Back

You can now navigate to the first or third card:

Sikkim Manipal University DDE

Page No. 30

WML and WAP Programming Practical

Exercise 12

Use the button with the up and down arrow to select the card that you want to display. Press select. When you enter the third card in the deck, it will display all three variables with their values.

----- Third Card ----Card 3 Card 1 var1=val_1 Card 2 var1=val_2 Back

WEBCOM PHONE
You can now navigate back to the first card by pressing the Back button twice. Now the first card contains values for all three variables:

----- First Card ----Card 1 var1=val_1 Card 2 var1=val_2 Card 2 var1=val_3 Options

WEBCOM PHONE

Sikkim Manipal University DDE

Page No. 31

WML and WAP Programming Practical

Exercise 13

Exercise 13

Task Shadowing and Inter-deck Navigation

Objective: After undertaking this exercise, you should be able to use the following WML elements. access head meta template noop Procedure: Type the code given below in the emulator and execute. <! deck2a.wml --> <?xml version= "1.0" ?> <! DOCTYPE wml PUBLIC "-// WAPFORUM//DTD WML 1.1//EN" http://www.wapforum.org/DTD/wml 1.1.xml> <wml> <template > <do type="prev" name="Previous" label ="Previous"> <prev/> </do> </template> <card id="card1" title="First Card" newcontext="true"> <p> Card1 ...<br/> <do type="accept" label="Next Card"> <go href="#card2"/> </do> <! --Must override the DO/PLREV in the template to prevent the PREV element from going back to the previous deck. --> <do type="prev" name="Previous"> <noop/> </do> </p> </card>
Sikkim Manipal University DDE Page No. 32

WML and WAP Programming Practical

Exercise 13

<card id="Card2" title="Second Card"> <p> card2 ...<br/> <do type="accept" label="Next Card"> <go href="#card3"/> </do> <Ip> </card> <card id="card3" title="Third Card"> <p> card 3... <br/> <!1 Note: The following DO element will go to a new deck. The name of this deck is embedded in the URL. --> <do type="accept" label="Next Deck"> <go href="deck2.wml"/> </do> </p> </card> </wml> Sample Output: When you navigate to the first card of the deck, the card displays only the Next Card soft key, since the Previous item described in the template has been overridden with a Previous item in the card specifying a noop task. (Note that this example is shown on a model phone).

----- First Card ----Card 1. . .

Next Card

Sikkim Manipal University DDE

Page No. 33

WML and WAP Programming Practical

Exercise 13

Pressing Next card sends you to the second card of the deck. The card contains the next card item specified in the card and the previous item specified in the template:

----- Second Card ----Card 2

Nextcard

Previous

Pressing Next Card sends you to the third card. The card contains the Next Card item specified in the card and the Previous item specified in the template:

----- Third Card ----Card 3 . . ..

Next Card

Previous

Sikkim Manipal University DDE

Page No. 34

WML and WAP Programming Practical

Exercise 13

The Next Deck menu item allows you to navigate to deck2b.wml, which contains a previous soft key, allowing you to navigate to the card you visited last:

----- First Card ----Deck 2, Card 1

Nextcard

Previous

WEBCOM PHONE

Sikkim Manipal University DDE

Page No. 35

WML and WAP Programming Practical

Exercise 13

Acknowledgements, References and Suggested Readings: 1. Wireless Application Protocol Forum Ltd. (2000). Wireless Application Protocol WML Script Language Specification 2. Martin Frost (2000), Learning WML & WML Script, First Edition. 3. Chris Tull (2002) .WAP 2.0 Development, Publisher-Que Publishing 4. Chris Bennett (2001). Practical WAP: Developing Applications for the wireless web. Cambridge University Press (UK) 5. Wireless Web Development with PHP and WAP by Ray Risch pater, Thomson Press India Ltd, India 6. www.developershome.com 7. http://www.w3schools.com/wap

Sikkim Manipal University DDE

Page No. 36

WML and WAP Programming Practical

Guidelines

Guidelines for Conducting Practical Exercises


The course titled WML & WAP Programming - Practical bearing the subject code BT0091 has 2 credit weight and the practical exercises have to be performed for a duration of 60 hours. The time allotment for the same has been indicated in Table 1. It contains 13 Exercises as given in the Table 2. Guided and Unguided Exercises The time allocated for various components is given below. The practical component of BT0091 WML & WAP Programming Practical has to be completed within 7 days of 14 sessions; each session has to be for a minimum of 3 hours. You are advised to consult the Learning Centre Faculty (LC Faculty) for the detailed practical schedule. Table 1: Time allotment for practical activities
Type of Activity Guided Exercises Unguided Self Study and Preparation of Record Total Day(s) 7 0.5 --7.5 Sessions 14 1 --15 Hours 42 3 15 60

In the course of these Exercises, the LC Faculty will provide you guidance, arrange for demonstration (wherever necessary), and clarify your doubts. You are required to follow the instruction provided by the LC Faculty and observe the demonstration exercises, carry out the exercises, prepare the Practical record book in accordance with the guidelines mentioned and submit the Practical record book to your LC Faculty. Each Exercise has assessment component, which will be carried out by your LC Faculty. Your attendance is compulsory for these Exercises. The assessment during the Guided sessions accounts for 70 marks (out of a total of 100 marks for 2 credit Practical subject). In short, during these Guided Exercises, your LC faculty will guide you and also assess your work.
Sikkim Manipal University DDE Page No. i

WML and WAP Programming Practical

Guidelines

The end semester examination will be conducted by the CoE for three hours for 30 marks, which forms the Unguided Exercise(s) (UGE), where one or more problem(s) will be assigned to you. The exercise prescribed as unguided could be based on the concepts underlying guided exercises, but need not be exactly the same. To complete the lab subject successfully, you have to score a combined average of 40% (i.e., 40 marks) in both Guided and Unguided parts together and a minimum of 35% in each part (i.e., 25 in marks in Guided part and 11 marks in Unguided part). In case of failure in either or both the parts, you have to redo the concerned part(s). Instructions Each experiment should be performed based on the algorithm outlined for each experiment. The faculty or the instructor at the LC should demonstrate the execution process of the software involved. The student should be motivated to produce different outputs from the program by providing varying inputs to each experiment and these outputs should be recorded in the individual student report. All the student records should contain the following details with respect to each and every exercise. Aim / Objective: It should contain a one or two line description of the problem being solved. Procedure / Algorithm: Should contain the step-by-step procedure or methods followed for completing the experiment. Code: WML code should be written presenting the steps involved in solving the problem. The detailed executable version of the program should be written by hand and a print out of these executable versions along with sample outputs should be taken; which should be signed by the concerned authority on the same date of experiment and other details should be recorded as given in table 2. A record of work should be submitted at the end semester examination.

Sikkim Manipal University DDE

Page No. ii

WML and WAP Programming Practical

Guidelines

Exercises The following is the list of experiments to be completed by the students within the timeline specified by the Learning Center. The list of exercises are given in Table 2. Table 2: List of Exercises
Sl. No. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. Title of the Exercise Installation, Configuration and Execution of WAP Toolkit Hello World example Paragraphs and Line Breaks Text Formatting WML Tables Links WML Events (onenterbackward) WML Selection Lists WML Events (onpick) WML Password Input Fields Reset Buttons in WML Referencing and Setting Variables Task Shadowing / Inter-deck Navigation Faculty Signature: Lab Administrator Signature: *External Examiner Signature: Date Duration (in Hrs) Remarks

Faculty Name: Lab Administrator Name: *External Examiner Name:

(* To be done at the time of final external examination) Note: Exercise 1 carries a weightage of 10 marks. Remaining exercises carries a uniform weightage of 5 marks. Sikkim Manipal University DDE Page No. iii

WML and WAP Programming Practical

Guidelines

Marks Allotment
Exercise Type Guided Exercises Unguided Exercises (External Examination) Total Practical Marks Marks Allotted 70 (10 + 12 x 5) 30 100 Minimum Pass Marks 25 11 Aggregate: 40%

Sikkim Manipal University DDE

Page No. iv

Вам также может понравиться