XHTML MP文档结构
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello world</title>
</head>
<body>
<p>Hello world. Welcome to javaeye.com.</p>
</body>
</html>
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello world</title>
</head>
<body>
<p>Hello world. Welcome to javaeye.com.</p>
</body>
</html>
JSP+WAP2.0文档结构
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<%@ page language="java" pageEncoding="UTF-8" %>
<%
// 自动解析PC web请求还是mobilephone web请求
String acceptHeader = request.getHeader("accept");
if (acceptHeader.indexOf("application/vnd.wap.xhtml+xml") != -1)
response.setContentType("application/vnd.wap.xhtml+xml");
else if (acceptHeader.indexOf("application/xhtml+xml") != -1)
response.setContentType("application/xhtml+xml");
else
response.setContentType("text/html");
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<%
//可加JAVA代码
%>
<head>
<title>新手任务-购买商品</title>
<link href="/css/main.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
.noviceDiv{
line-height:21px;background:#DDEEF6;padding:5px 10px 5px 15px;border-top:1px solid #9FD1F3;
}
</style>
</head>
<body>
<div class="noviceDiv">
<strong>新手任务</strong>
</div>
<h5>当前页面 > 商店</h5>
<p>
${message }
</p>
<p>
<a href="<%=request.getContextPath()%>/treeController.html?flag=plantTree&novice=yes">赶快将买回来的树苗种到山上去吧!</a>
</p>
</body>
</html>