[b]web.xml[/b]
[b]500.jsp[/b]
Notes:需要在errorpage加入isErrorPage="true",否则,可以找到500.jsp,但是不能使用exception,从结果来看,虽显示500.jsp页面的内容,但并不会跳转到500.jsp
[img]http://dl.iteye.com/upload/picture/pic/132919/11fcd8be-1c82-392c-a730-07541be2c2dd-thumb.png[/img]
<web-app>
<display-name>Archetype Created Web Application</display-name>
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/error/500.jsp</location>
</error-page>
</web-app>
[b]500.jsp[/b]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" isErrorPage="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>500 ERROR</h3>
<%=exception.getClass() %>:<%=exception.getMessage() %>
</body>
</html>
Notes:需要在errorpage加入isErrorPage="true",否则,可以找到500.jsp,但是不能使用exception,从结果来看,虽显示500.jsp页面的内容,但并不会跳转到500.jsp
[img]http://dl.iteye.com/upload/picture/pic/132919/11fcd8be-1c82-392c-a730-07541be2c2dd-thumb.png[/img]