在web.xml 里面配置
<error-page>
<error-code>404</error-code>
<location>/http_error.jsp</location>
</error-page>如果登录 login.jsp 页面 ,页面存在已经登陆上去了,但是页面上有个图片的地址不对下面是http_error.jsp 页面 后台就会输出一直输出 statusCode=404(地址改对后台就不会一直输出statusCode=404),但是又不会跳转到404.jsp 页面,这个奇怪的BUG 有谁知道吗?//下面是http_error.jsp页面
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'http_error.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<%
int statusCode = (Integer)request.getAttribut("javax.servlet.error.status_code");
System.out.println("statusCode="+statusCode);
if(statusCode==404)
response.sendRedirect("404.jsp");
if(statusCode==500)
response.sendRedirect("500.jsp");
%>
</body>
</html>
<error-page>
<error-code>404</error-code>
<location>/http_error.jsp</location>
</error-page>如果登录 login.jsp 页面 ,页面存在已经登陆上去了,但是页面上有个图片的地址不对下面是http_error.jsp 页面 后台就会输出一直输出 statusCode=404(地址改对后台就不会一直输出statusCode=404),但是又不会跳转到404.jsp 页面,这个奇怪的BUG 有谁知道吗?//下面是http_error.jsp页面
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'http_error.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<%
int statusCode = (Integer)request.getAttribut("javax.servlet.error.status_code");
System.out.println("statusCode="+statusCode);
if(statusCode==404)
response.sendRedirect("404.jsp");
if(statusCode==500)
response.sendRedirect("500.jsp");
%>
</body>
</html>
解决方案 »
- struts 2 关于登录验证问题
- Spring AOP问题
- SERVLET中session使用的问题
- 如何避免IE“窗口弹出阻止”功能阻止弹出窗口,急!已经想了一星期了,恳请高手帮忙!
- jsp连接access数据库问题!
- 初学者,请大家帮帮忙,JSP程序怎么运行的?
- 怎样从<td></td>里取的数据?
- 如何编写javabeans以及详细的存放目录?
- 关于通过Servlet上传下载的问题求教
- springMvc中@RequestBody异常错误解答
- 问下,页面传入一个字符串,我要判断里面是否有汉字,如果有汉字,就按照第一步处理,如果没有汉字,就按照第二步处理!
- jsp session购物车问题。请高手改正。
<error-page>
<error-code>500</error-code>
<location>/commons/error.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/commons/404.jsp</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/commons/403.jsp</location>
</error-page>