It is possible to use JSPs to generate WML content, using the content type
vnd.wap.wml”. It is possible to use two different applications or to put
all the JSPs, both for the web and for WAP, in the same application. The
latter solution has the advantage of simplicity.
To have a single point of access (e.g. http://server.com/UbiMail) we need
to recognize which type of browser is connected and then address it to the
correct interface. We introduce a new JSP, Accept, that is responsible for
recognizing the browser type. The Accept JSP then redirects the user to the
web or WAP interface as shown in Figure 16.10. To identify the type of
browser (HTML or WML) the Accept JSP looks into the “accept” header of
the HTTP request. If the accepted content types include “text
we deduce that there is a WML browser, otherwise we assume it is an HTML
The WAP version of the UbiMail interface is made up of pages written in
WML. The initial page, index.wml , is a static page that asks the user for user-
name and password. This information is sent to the wap_login JSP that
authenticates the user, as the Login JSP in the web interface. The wap_main
JSP presents the user with a list of the messages on the mail server.
The entry point of the WAP interface is the index.wml file. It is a static WML
page that prompts the user for username and password and gives control to
the WAP login JSP.
<?xml version # "1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
<do type # "prev"><prev/></do>
<card id # "login" title # "UbiMailLogin">
<do type # "unknown" label # "Login">
Figure 16.10 Design of the WAP access