有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Servlet异常映射

我想在出现异常时显示一个特定的jsp。我有一个自定义的例外。 我已经把它映射到网上了。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");
}

请帮我指出我的流程/逻辑中的错误。 谢谢!


共 (0) 个答案