views:

185

answers:

1

I tried to use

<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/errors/error.jsp</location>  
</error-page> 

but i dosen't catch 404 errors. How can I catch also 404 etc. errors to that same page ? I want to catch ALL error codes to same error page jsp.

+3  A: 

You can add an <error-code> tag for that

<error-page>
    <error-code>404</error-code>
    <location>/errors/error.jsp</location>
</error-page> 

UPDATE:

As per your updated question - you'll have to define EACH error-code individually in the web.xml.

Using <exception-type>java.lang.Throwable</exception-type> will catch the error 500s but not 404s

JoseK
I know that, but I want to catch ALL error codes to same page
newbie
@newbie - so you add an <error-page> for each and every error code, all of them pointing at the same page.
Stephen C