开发者

Display Exceptions in JSF | JSP Page

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜