开发者

Display Exceptions in JSF | JSP Page

开发者 https://www.devze.com 2022-12-23 05:24 出处:网络
i\'am using JSF and Spring in a web application. If the Spring Controller throws exceptions i map them to special views.

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

精彩评论

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