We had the same problem with exceptions in BB constructors...Our solution was not pretty, but here it is:
 
Yes, the new page was always partially rendered before we could catch the error in time. The suggestions
I got from the forum was to simply set the flush directive to false in tiles...but it never worked properly.
 
 
1) We created a servlet which simply redirects to a JSP error page.
2) From an error in a BB contructor error - we mapped it to the servlet via web.xml
3) From a jsp parsing error - we used the "errorPage" directive and mapped it to the same servlet.   %@page errorPage="/error/ErrorHandlerServlet" %
 
An alternative solution is to use a controller and have the controller execute the code which might generate an exception.
(This is what we have decided to do for the future.)
 
 
We are also interested in alternative solutions.
 
 


De : Michael Heinen [mailto:[EMAIL PROTECTED]
Envoyé : lundi 3 avril 2006 12:44
À : MyFaces Discussion
Objet : RE: ExceptionHandling with JSF and Tiles

Has anybody a hint? 

 


From: Michael Heinen [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 30. März 2006 09:41
To: MyFaces Discussion
Subject: ExceptionHandling with JSF and Tiles

 

Hi all,

 

I am still confused about Exception Handling. I know that this has been discussed on many threads but I don't know how to handle exceptions

outside Actions/ActionListeners.

 

My setup is MyFaces 1.1.1 and Tiles with the JspTilesViewHandlerImpl.

 

I can create FacesMessages and forward to any outcome page when an exception occurs in an action/actionListener. This is working fine and no problem.

 

I don't know how to handle serious errors in BackingBean constructors or setters.

I tried to catch them and re-throw them as FacesExceptions but my error pages (defined in web.xml) are not displayed. 

Instead of the error page the original requested tiles template is partly processed.

A ServletException is displayed in place of the tiles-part that caused the error.

e.g. ServletException in:/xxx.jsp] Cannot get value for _expression_ '#{ABackingBean.aValue}'

  

How do others handle exceptions with myFaces and Tiles?

Are there any best practices?

 

Any help would be greatly appreciated.

Michael

Reply via email to