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>开发者_StackOverflow社区;
<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
It's available in the request scope by key "exception"
.
<p>Exception message: ${exception.message}</p>
<p>Exception cause: ${exception.cause}</p>
精彩评论