Java Reference
In-Depth Information
<%
}
user.closePopServer();
%>
</p>
</card>
<%
} else {
session.invalidate();
%>
<card id # "hello" title # "UbiMail">
<p>
Sorry the user name or the password is incorrect.
</p>
</card>
<% } %>
</wml>
To provide a single point of access to both the web and WAP user inter-
faces we define the accept.jsp that analyses the request from the browser
and redirects the browser to the correct initial page. The type of browser is
identified by looking at the “accept” header.
<%
String accept # request.getHeader("accept");
if (accept.indexOf("text/html") > # 0 ){
response.sendRedirect("index.html");
return ;
} else
if (accept.indexOf("text/vnd.wap.wml") > # 0 ){
response.sendRedirect("index.wml");
return ;
}
%>
Cannot serve any of the accepted formats: <% # accept %>
The previous JSP must be set as the welcome file in the application
descriptor web.xml.
<web-app>
...
<welcome-file-list>
<welcome-file>accept.jsp</welcome-file>
</welcome-file-list>
</web-app>
16.5.4
Test
To test the system it is important to access the system via a WAP emulator
(e.g. the Nokia Mobile toolkit) and possibly via a WAP phone. If the WAP
 
Search WWH ::




Custom Search