errorPage directive works, but error-page in web.xml doesn't?

Posted by danb on Stack Overflow See other posts from Stack Overflow or by danb
Published on 2010-05-07T17:46:42Z Indexed on 2010/05/07 19:08 UTC
Read the original article Hit count: 182

Filed under:
|
|
|

I get jsp exceptions causing a forward to my error page when I put this at the top of my JSPs...

<%@ page errorPage="/error.page" %>

but when I try to do it globally with web.xml like so:

<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/error.page</location>
</error-page>

I just get a blank page... I've also tried putting /error.jsp in the location element.. but no love with that either..

I am triggering an exception with a jsp that just contains this:

<%if(true)throw new RuntimeException("test exception");%>

I do see the exception in the console from tomcat but I just can't get that error page to show without a directive on every jsp... am I missing something simple here?

© Stack Overflow or respective owner

Related posts about error-handling

Related posts about jsp