servlet的强大之处吧,算是....
利用servlet动态生成wap页面
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException { PrintWriter out = null;
try{
res.setContentType("text/vnd.wap.wml;charset=UTF-8");
out = res.getWriter();
// out.print("<?xml version=/"1.0/" encoding=/"UTF-8/"?>");
// out.print("<!DOCTYPE wml PUBLIC /"-//WAPFORUM//DTD WML 1.1//EN/" /"http://www.wapforum.org/DTD/wml_1_1.dtd/">");
this.wmlContentType(out);
out.println("<wml>");
out.println("<card id=/"Code/" title=/"Code/">");
out.println(" <p>");
out.println(sss);
out.println(" </p>");
out.println("</card>");//可以添加上card
out.println("</wml>");
}catch(Exception e){
}
private void wmlContentType(PrintWriter out){
out.print("<?xml version=/"1.0/" encoding=/"UTF-8/"?>");
out.print("<!DOCTYPE wml PUBLIC /"-//WAPFORUM//DTD WML 1.1//EN/" /"http://www.wapforum.org/DTD/wml_1_1.dtd/">");
}
原理很简单,利用servlet生成wap页面的内容,然后可以输出成*.wml等等
再有个好玩的,可以利用apache做个动态二级域名分配这样,wap站点就生成了!