JSP 错误处理问题,知道的请进来!!!!!
在web.xml中配置了,如下代码
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/MyErrorPage.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/FileNotFound.jsp</location>
</error-page>
为什么当页面出现异常时,转不到指定的错误页面那?
FileNotFound.jsp如下:
<html>
<head>
<title>Bad URL</title>
</head>
<body>
<h3>Bad URL</h3>
The resource you are trying to reach,
<%=request.getRequestURL()%>, does not exist on this server.
</body>
</html>
MyErrorPage.jsp如下:
<%@ page isErrorPage="true" %>
<h1>hello ,o k</h1>
<%= exception%>