[jboss-user] [JBoss Seam] - Error handling with error pages
do-not-reply at jboss.com
Mon Feb 4 08:14:21 EST 2008
my goal is to add a custom error page to an existing seam app which should display both the (technical) description of the error with <h:messages> and a short sentence that can be understand by a normal user (e.g. "connection to database failed. please try again later") and depends on what kind of error occured, of course.
This should be achived with a singe error page.
I am not able to change the code of the app, so I can not raise custom exceptions in my beans.
Therefore, I started with an entry in exceptions.xml, which redirects two exemplary kinds of errors that occur before render phase to my generic error page.
| <exception class="java.lang.RuntimeException">
| <redirect view-id="/genericError.xhtml">
| <exception class="javax.servlet.ServletException">
| <redirect view-id="/genericError.xhtml"></redirect>
Well, now I can access the technical error message in genericError.xhtml with
<h:messages globalOnly="true" styleClass="message" />
But how can I detect because of which of the two exceptions the error page was displayed, so that I can show the correct textual message? Is there something like a global error object?
Or can I pass the desired message or the kind of exception to my genericError.xhtml in some way?
I tried <param ..> but I did not get it to work.
Thanks in advance,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126137#4126137
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126137
More information about the jboss-user