servlet异常映射



我想在异常时显示特定的JSP。我有一个自定义例外。我已经在Web.xml

中映射了它
  <error-page>
    <location>/WebContents/A3/jsp/test.jsp</location>
  </error-page>

这是我的自定义异常

public class TestFileListException extends ServletException

这就是我的servlet

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        throw new TestFileListException("werw");
}

请帮助我指出我的流/逻辑中有什么问题。谢谢!

尝试以下:

<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/WebContents/A3/jsp/test.jsp</location>
</error-page>

最新更新