一段可以运行的xhtml的jsp代码
<?xml version="1.0" encoding="UTF-8"?>
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!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>
<base href="<%=basePath%>"/>
<title>这里是title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>这是第一个XHTML页面 </p>
</body>
</html>
相关文档:
1、<%=(new java.util.Date()).toLocaleString()%>
2、<script language= "javascript ">
var today=new Date()
var month=today.getMonth()+1
document.write(today.getYear()+ "年 "+month+ "月 "+today.getDate()+ "日 ")
  ......
今天在调试代码时,发现一段写在jsp端的java代码怎么编译,设置断点都不会在断点处停留。百思不得其解,在同事的帮助下,发现是代码注释有问题。
原代码:
<!-- <jsp:forward page="/hello/Welcome.do"/> - ......
<%@page import="com.opensymphony.xwork2.util.ValueStack"%><%
ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");
String aa = (String)vs.findValue("downloadContent");
response. ......
context.xml 文件夹中
<Context path="/wap"
docBase="D:\IDE\MyEclipse\wap\WebRoot" reloadable="false" >
request.getContextPath(); -==> /wap
this.getServletContext().getRealPath("") ;// D:\IDE\MyEclipse\wap\WebRoot
......