myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Heinen" <...@recommind.com>
Subject RE: ExceptionHandling with JSF and Tiles
Date Tue, 04 Apr 2006 13:59:26 GMT
Thanks for your answer.

I tried this and your points 1) and 2) are working well.

 

But I can't get jsp errors redirected to the error jsp.

The ErrorHandlerServlet is called but the content of my error jsp is not displayed in this
case.

The tiles are still partially rendered and the previous ServletException (s. mail below) is
not displayed anymore. 

 

Where did you define the errorPage directive ?

In the outer tiles layout template or in the various included tiles definitions (e.g. in all
content jsps)? 

Hmm, I tried both and it is not working.

 

Thanks for your help

Michael

 

 

________________________________

From: Cote.Mark@hydro.qc.ca [mailto:Cote.Mark@hydro.qc.ca] 
Sent: Montag, 3. April 2006 19:12
To: users@myfaces.apache.org
Subject: RE: ExceptionHandling with JSF and Tiles

 

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" % <mailto:%25@page%20errorPage=>


 

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:mhn@recommind.com] 
	Envoyé : lundi 3 avril 2006 12:44
	À : MyFaces Discussion
	Objet : RE: ExceptionHandling with JSF and Tiles

	Has anybody a hint? 

	 

	
________________________________


	From: Michael Heinen [mailto:mhn@recommind.com] 
	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


Mime
View raw message