• Print  |
  • Feedback  |

FOCUS AREAS

Developer Resources

Products

Technologies

API Reference

SAS AppDev Studio 3.0 Developer's Site

webAF's IPage TransformationBeans for Wireless Applications

Overview of WAP/WML

Wireless Application Protocol (WAP) is a global standard for applications over wireless networks. It means that WAP provides a uniform technology platform with consistent content formats and protocols for delivering Internet and Intranet information to digital mobile phones and other wireless devices. Wireless Markup Language (WML) is used to create pages that can be displayed in a WAP browser. WML is a markup language based on the Extensible Markup Language (XML) and is used to specify the format and presentation of text, hierarchies of screens (known as a "deck"), and hyperlinks between those screens (or "cards"). It is designed for specifying user interface behavior and displaying content on wireless devices such as phones, pagers, and Personal Digital Assistants (PDAs).

The WAP operates as follows:

  1. The user presses a phone key that has an URL request assigned to it.
  2. The user agent sends an URL request to a WAP gateway using the WAP protocol.
  3. The WAP gateway creates a conventional HTTP request for the specified URL and sends it to the web server.
  4. The HTTP request is processed by the web server. The URL may refer to a static file or to a JSP
  5. The web server returns the WML deck with the added HTTP header or the WML output from the JSP or other script application.
  6. The WAP gateway verifies the HTTP header and the WML content and encodes them to binary form. The gateway then creates a WAP response containing the WML and sends it to the user agent.
  7. The user agent receives the WAP response. It processes the WML response and displays the first card of the WML deck to the user.

Introduction to IPage TransformationBeans

IPage TransformationBeans are a set of intelligent beans that are capable of writing out the appropriate markup language for a particular device. Unlike other webAF TransformationBeans, the IPage TransformationBeans write out an entire JSP page to the device or browser making the request. Most of this information is found within the JSP page's request headers. For example, if a user accesses a JSP page containing an IPage from their cell phone, the IPage bean will produce either WML (Wireless Markup Language) or HDML (Handheld Device Markup Language) based on the type of browser the cell phone contained. If another user accesses the same JSP page using Internet Explorer, the IPage bean would produce HTML instead.

When a mobile phone or other wireless device tries to access an IPage JSP page, the bean first determines what type of markup language to return. The IPage bean will then write out the entire page by first writing out the header of the page. A phone which contains a WML browser would receive the following lines as a header from the JSP page:

	<?xml version="1.0"?>
	<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" 
         "http://www.wapforum.org/DTD/wml_1.1.xml">
	<wml>

Header output is similarly written for HDML enabled phones or HTML browsers accessing the page. After writing out the header, the IPage specific markup is written to the page. This might be a page or card of text from an IPage bean, markup for an iMenu, or some type of user input described in an iForm bean. The footer is the last to be written. The following footer line would be written if the device was a phone with a browser which supported WML:

	</wml>
	

Using IPage TransformationBeans in a JavaServer Page

The IPage TransformationBeans will enable the automatic generation of content using Java on the server using a JSP page. In this release, the following IPage TransformationBeans are available.

IPage TransformationBean Description
IText Creates a single page of text
IMenu Creates a menu used for navigation
IForm Creates a form for obtaining user input

The IText bean is used to write out an entire page or card of text. The JSP coder does not need to know the type of requesting device. Here is a small JSP page that uses the IText bean:

	<%
		com.sas.servlet.tbeans.ipage.IText text = 
		  new com.sas.servlet.tbeans.ipage.IText(request, response);
		
		text.setText("Hello World!");
		text.setTitle("IText Example");
		text.write(out);
	%>
	

The first 2 lines create the IText bean and pass in the JSP page's request and response objects. The request object is used to determine what type of device is requesting the page. The response object will set the correct content type to return to the device. The setText and setTitle methods set the output to be displayed and the title of the IText. Calling the write method sends the final markup to the device. The resulting markup for the IText for WML, HDML, and HTML is as follows:

WAP Simulator Toolkits

There are many development tools out there to help you create WAP applications. Here are some of the tools currently available.

For related information about IPage and other TransformationBeans available in webAF, see webAF and the SAS Custom Tag Library.