views:

180

answers:

1

Hi,

i'am using JSF and Spring in a web application. If the Spring Controller throws exceptions i map them to special views.

Now I'd like to catch all exceptions which are thrown out of scope of the Spring Context.

In my web.xml i've defined an error page.

<!-- handle uncaught exceptions -->
<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/views/error/uncaughtexception.jsp</location>
</error-page>

In this page I would like to display the exception and the exception cause.

How can i access and display the exception in the error.jsp?

THX

+2  A: 

It's available in the request scope by key "exception".

<p>Exception message: ${exception.message}</p>
<p>Exception cause: ${exception.cause}</p>
BalusC