1.可以使用:
[table=600][tr][td] response.sendRedirect("http://www.foo.com/path/error.html"); [/td][/tr][/table]
2.可以手工修改HTTP header的Location属性,如下:
[table=600][tr][td]<%
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
String newLocn = "/newpath/index.html";
response.setHeader("Location",newLocn);
%> [/td][/tr][/table]
3.也可以使用forward:
请注意:只能在任何输出还没有发送到客户端之前使用这种方式。
5.6 类似global.asa的做法 在JSP中没有global.asa的对应物。但可以有一个workaround来运行。例如,如果你需要存储或存取application scope变量,你总是可以创建一个
javabean,并在页面中需要这些变量的地方将它包含进来。
但是,也有一些产品具有这样的对应:
Allaire公司的产品JRun 3.0将提供global.jsa。JRun 2.3.3仍然给予支持,但只对JSP 0.92。当JRun 3.0最终推出时它将支持用于JSP 1.0和1.1的global.jsa。
你可以从
http://beta.allaire.com/jrun30得到JRun 3.0 beta 5
另外,Oracle的JSP支持globals.jsa。
5.7 jsp显示当前时间 5.8在JSP中创建目录 Mkdir(String path) 5.9将return 转为<br>函数