【发布时间】:2016-07-16 19:40:48
【问题描述】:
我正在编写 servlet,如果出现异常,我会重定向到我的自定义错误页面,因为我已经这样做了。
在 web.xml 中
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/WEB-INF/jsp/ErrorPage.jsp</location>
</error-page>
在 Servlet 中,
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try{
//Here is all code stuff
Throw new Exception();
}catch(Exception e){
e1.printStackTrace();
}
但是这里ErrorPage.jsp 没有显示,我哪里出错了谁能解释我?
【问题讨论】:
标签: java jsp servlets exception-handling error-handling