出错页面跳转
<error-page>
<error-code>404</error-code>
<location>/http_error.jsp</location>
</error-page>
<error-page>
<error-code>505</error-code>
<location>/http_error.jsp</location>
</error-page>
<%
//获得跟路径
String path=request.getContextPath();
//获得错误代号
Integer code=(Integer)request.getAttribute("javax.servlet.error.status_code");
if(code.intValue()==404){
response.sendRedirect(path+"/404.html");
}else if(code.intValue()==505){
response.sendRedirect(path+"/505.html");
}
%>
----------------------------
<error-page>
<exception-type>com.bjsxt.drp.util.AppException</exception-type>
<location>/error.jsp</location>
</error-page>
isErrorPage="true" jsp才能使用 exception 对象
<%@ page contentType="text/html;charset=GB18030" %>
<%@ page isErrorPage="true" %>
<td>
<%=exception.getMessage()%></td>
--------------------------------------