This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSF and the fly likes Handling jsf exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Handling jsf exception" Watch "Handling jsf exception" New topic
Author

Handling jsf exception

anitha meena
Ranch Hand

Joined: Oct 22, 2007
Posts: 40
Hi All,

I am trying to handle the exceptions in jsf , i have added the following to the web.xml

Exception handling part of web.xml




error500.xhtml




in some of the pages of the application am getting something like dataAccessException and it is redirecting to the page called /pages/common/error500.xhtml

i am facing the following 2 problems:

1) during existance of such dataAccessException and after redirecting to the page error500.xhmtl , the contents of page error500.xhtml is not displayed in a proper way that is am getting the title page "ErrorPage" but the contents of the page ( i mean the output label) is not displayed
2) how to display the exception type in this page error500.xhtml (e.getMessage())


thanking all of you in advance
anitha meena
Ranch Hand

Joined: Oct 22, 2007
Posts: 40
any reply
Samuel March
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
2) how to display the exception type in this page error500.xhtml (e.getMessage())

That one is quite fatal on the application, generally if you see that , always restart the VM.


...did you have the fish?!............................ No.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15624
    
  15

Without actually checking, I'll make a strong bet that it's because you're attempting to use JSF on the error pages.

JSF requires a fair amount of context that isn't available when a view request is made by the webapp container, which is what happens when you provide a view URL in the web.xml file. I can definitely state that you can't use JSF on container login pages, for example, although login is a more complex process anyway.

The problem isn't just JSF. Struts, for example, also has the same issues.

I think you can get around this by making the error pages do redirects, but for the most part error pages are better off not doing anything ambitious enough to require JSF anyway. Since these pages all indicate serious errors, the backing bean data isn't 100% guaranteed reliable at that point. For errors in the application logic itself, you're better off catching the exceptions and dispatching them as application error pages instead of letting them fly off to container-land.


Customer surveys are for companies who didn't pay proper attention to begin with.
anitha meena
Ranch Hand

Joined: Oct 22, 2007
Posts: 40
Hi Samuel March , Thanks for your reply , am using jboss application server....

Hi Tim Holloway thanks for your reply , but am still getting the same error.......
anitha meena
Ranch Hand

Joined: Oct 22, 2007
Posts: 40
any reply or suggestion
 
wood burning stoves
 
subject: Handling jsf exception
 
Similar Threads
Handling Exception/Runtime Exception in JSF
Bug in chrome
I don't want expose my application's behind to everyone!
Not Redirecting to error page
Rich faces not working in xhtml pages