Home Wap Writing your First WAP Application.
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Writing your First WAP Application.

Advertisement
Writing your First WAP Application. Tutorial Writing your First Application. N ow it's time to mould your Internet Data for the entire Unwired World! Our "Welcome to Unwired World" application will familiarize you with the WML code. As

Welcome to Unwired World! Output

  

Writing your First Application.

Now it's time to mould your Internet Data for the entire Unwired World!

Our "Welcome to Unwired World" application will familiarize you with the WML code. 

 
 
As mentioned earlier WAP applications are written in WML (Wireless Markup Language). Now first of all we will explain the WML. WML is a markup is strongly similar to HTML and is based on Extensible Markup Language(XML). Formal Document Type Definition (DTD) for WML is provided by WAP Forum and is available at:

  http://www.wapforum.org

Getting Started
To write a WML page you can use your favourite text editor like Notepad or Wordpad. After writing it save as '.wml' file. U.P. Browser (download and Install Phone.com - UP.SDK 4.x) can be used to test the page. Our site also provide the facility for you to test your code.

Understanding Deck and Card
The whole WML-page is called a Deck and it consists of one or more cards. Each card contains the information that is displayed on the cellular devices in one screen. So in one Deck you can define one more screens. Cellular device displays first card when it receives a Deck. And in first card using elements and attributes we can define our navigational structure between different cards.

Let's create our first application. So, here is the code of our application.

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"

"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="Card1" title="Learning WML ">

<p>

Welcome to Unwired World!

</p>

</card>

</wml>

To test the above code copy and paste below and then press test button.


  

In any WML application first three line is must and it contains the XML and document type declaration.

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"

"http://www.wapforum.org/DTD/wml_1.1.xml">

 

After XML and document type declaration WML deck start with <wml> and ends with </wml> tags. Each deck may contain one or more cards. First card of WML page is displayed by the cellular device and this card provides the links to the other cards of the deck. 

<wml>

<card id="Card1" title="Learning WML ">

<p>

Welcome to Unwired World!

</p>

</card>

</wml>

WML card starts with <card>and ends with </card> tag. Attribute "id" of card element gives the identity to the card and using this id we can refer any card in the WML page. Next is <p> tag which we are using to display the paragraph. We can use <p>, <b>, <i>, <br>, <a> in our programming and these tags are identical to the HTML tags.   

Tags Functionality
<p> Writing paragraph
<b> Writing bold text
<i> Writing italic text
<br> Inserts a line break
<a> Creates a link

By the end of this chapter you are very much familiar with the WML language. Now try the follwing WML script which uses the different formating tags. You can test your script by copying and pasting the code in above text area and pressing the test button.

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"

"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="Card1" title="Learning WML ">

<p>

Welcome to Unwired World! <br/> Line break<br/>

<b>This is bold.</b><br/>
<i>This is italic.</i><br/>
<b>This is bold.</b><br/>
<u>This is underline.</u><br/>
<small>This is small.</small><br/>
<strong>This is strong.</strong><br/>
</p>  

</card>

</wml>

Now write your own scripts and test it.

In the next section you will learn how to write more than one cards in a deck and define the navigational links between them. 

 
  

Tutorial

  

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 30, 2005

Ask Questions?    Discuss: Writing your First WAP Application.   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com