Developing WAP applications in Java technology

xiaoxiao2021-03-06  54

WAP Development Getting Started - Building an Development Environment This article describes how to build a WAP development application, this article will tell how to develop WAP applications using Java technology.

We still use Tomcat as a web server, if you are not familiar with how to use Tomcat, please refer to Tomcat Getting Started Guide. Usually we have developed WAP applications to write WML scripts, in fact, we can develop WAP applications with Java servlet / JSP technology. Usually I have written servlet / jsp files using the Lomboz plugin in the environment of Eclipse. First look at the Waptest.jsp file and wapservlet.java file <% response.setContentType (" text / vnd.wap.wml "); out.println (" "); Out.Println (" "); out.println ("

"); OUT.Println (" Date and Time Service "); Out.println (" Date IS: " new java.util.date ()); out.println (" "); out.println (" "); out.println (" ");%> Package com.j2medev.mingjava;

Import java.io.ioException; import java.io.printwriter;

Import javax.servlet.ServletException; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletRequest; import javax.servlet.http.httpservletResponse;

Public class wapservlet extends httpservlet {

Protected void doget (httpservletRequest request, httpservletResponse response) throws servletexception, ioException {

Response.setContentType ("text / vnd.wap.wml");

PrintWriter out = response.getwriter ();

Out.println (""); out.println ("); out.println (" "); Out.Println (" "); out.println ("

"); OUT.Println (" Date and Time Service "); Out.println (" Date IS: " new java.util.date ()); out.println (" "); out.println (" "); Out.println (" ");}

Protected Void Dopost (httpservletRequest Request, HttpServletResponse response) throws servletexception, ooException {dogt (request, response);} The two file implementations are the same, displaying the current time of the server. Our contents of our web.xml are as follows: wapservlet com.j2medev.mingjava.wapservlet wapservlet / wapservlet index.jsp

404 / error.jsp

转载请注明原文地址:https://www.9cbs.com/read-114130.html

New Post(0)