JSP 绝对路径 终极解决方案
context.xml 文件夹中
<Context path="/wap"
docBase="D:\IDE\MyEclipse\wap\WebRoot" reloadable="false" >
request.getContextPath(); -==> /wap
this.getServletContext().getRealPath("") ;// D:\IDE\MyEclipse\wap\WebRoot
相关文档:
//下面,从请求中得到属性 为一个 类,,会判断是否为null,,如为null则实例化
// id 值 相当于 class 的 对象名
<jsp:useBean id="order" class="com.entity.Order" scope="request" />
<==>
<%
Order order=(Order)request.getAttribute("order");
if(order==null)
  ......
在当前应用系统的web.xml里加入jsp-config代码:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<jsp-config>
< ......
1.JSP中页面定时刷新
Java
代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://penghuaiyi.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" src="http://penghuaiyi.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=%3C%25%0A%20%20 ......
<tr>
<td height="30" align="right">域名:</td>
<td align="left"><input name="domain" type="text" class="input" value="<%=request.getServerName()%>"/></td>
<td align="left">系统已经检测出您的域名,请勿改动</td>
</t ......
源代码,a.jsp往b.jsp传值:
a.jsp页面内容
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<form action="b.jsp">
name:<input type=text name=name>
<input type=submit>
</form>
b.jsp页面内容:
<%@ page language="java" import="java.ut ......