WML is to WAP what HTML is to HTTP. However, because of the lack of bandwidth and the minimum capability of WML browsers embedded in mobile phones, WML has been developed into a much slimmer language, shedding all the features of HTML that would be useless for wireless devices. Let’s take a closer look at WML.
Check out these articles on wireless development
Shuffle the deck
The WML parallel of an HTML page is termed a deck. So when you try to access a WAP site using any WAP-enabled device, what is actually getting to your device is a deck. A deck can be broken down into cards. In fact, what is visible at a glance is one card and not an entire deck. These cards can link to other cards, and navigating to other cards is possible programmatically as well as in response to user input.
A deck is the smallest unit that can be sent by the server to a WAP client, and it can contain one or more cards. Listing A contains a sample WML file.
This example is a basic WML deck containing three cards. The card with the id “first” is, not surprisingly, the one that is displayed first. Although the other cards also come to the client as part of the deck, they are not initially visible. On clicking the Click Here link, the second card is visible. It has an image and an embedded list box.
What is interesting is the use of $(OS) in the third card. OS here refers to the list box name on the second card. Hence, based on selection made on the second card, the message on the third card can change.
The WAP toolbox
If you are wondering how in the world you are going to check out how this WML content would be displayed on a mobile phone, fret not. More than a handful of WAP simulators and development tools exist. The best of the lot seems to be the WAP Toolkit provided by Nokia. Since Nokia is ubiquitous in the mobile market, you surely want your WML pages to be displayed properly on its handset.
If you are using Macromedia Dreamweaver, a pretty nifty way to get your WML pages done in no time would be to get hold of the Nokia WML Studio plug-in for Dreamweaver. It makes WML development with Dreamweaver a cinch.
Most of the leading handset providers, such as Ericsson and Motorola, have toolkits that can simulate how your page will look on their respective handsets. If you are looking for a basic editor that will quickly get some pages up, Coffee Cup Wireless Web Builder is a solid product that includes an easy-to-use WML page creator.
Jazz up your WML
Pure text pages are boring. To spice up your WML pages, you need well-placed but sparingly used WBMP images. WBMP is the WAP image standard format. Creating WBMP images is definitely not a tough task, but you can get tons of images that suit your purpose from the Net. If you are still keen on creating your own images, try your hand at the WBMP image maker included with the Coffee Cup Wireless Web Builder.
Dynamic pages that send data to the server are pretty much essential for you to do anything worthwhile on the Net these days, so WML needs the capability to submit user data.
There is no direct HTML <form> tag parallel in WML. To submit data, you use postfields, and you use the $ sign to fetch user input and pass it on to the specified href. Listing B provides an example. Upon clicking Submit to Servlet, the data that’s been entered in the Login and Password fields would be passed on to the specified servlet. So if I enter Harshad in the Login field and Oak as my password, on submission, my query string should look something like
WAP yourself into shape
Get going with WML and make your presence felt in the wireless world. A significant advantage of having WAP expertise is that although it is pretty easy to latch on to, it still is rather rare in the technical marketplace.
Are you working with wireless technologies?
Share your wireless development experience with the Builder.com community by posting in the discussion below or send us an e-mail.