1、在web.xml里面配置,因为IE要配置中间页面转一下才能正常显示,火狐正常。
<error-page>
<error-code>404</error-code>
<location>/http_error.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/http_error.jsp</location>
</error-page>
2、转换页面
<%
Integer code = (Integer)request.getAttribute("javax.servlet.error.status_code");
if(code==404){
response.sendRedirect(request.getContextPath()+"/404.jsp");
}else if(code==500){
response.sendRedirect(request.getContextPath()+"/500.jsp");
}
%>
本文介绍如何在web.xml中配置404和500错误页面,并通过中间页进行跳转以确保不同浏览器的兼容性。

被折叠的 条评论
为什么被折叠?



