jsp页面显示后台错误

web.xml
<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>


500.jsp
<%@ 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

你可能感兴趣的:(jsp)