myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Myfaces Wiki] Update of "Handling Server Errors" by LeonardoUribe
Date Thu, 11 Sep 2008 22:07:16 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by LeonardoUribe:

  Server errors such as HTTP 500 can occur for a number of reasons such as uncaught exceptions,
missing JSFs or backing beans, bad URL and the list goes on. While we hope these only occur
during development it is important to plan to catch and deal with these errors gracefully
when running live with multiple users.
  Several approaches have been discussed on the mailing list:
+ === Use default handler ===
+ Myfaces has a default error handler (class javax.faces.webapp._ErrorPageWriter) that uses
a jsp template file (META-INF/rsc/myfaces-dev-error.xml and META-INF/rsc/myfaces-dev-debug.xml)
to handle errors.
+ For define a custom template file:
+ {{{
+   <context-param>
+     <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
+     <param-value>true</param-value>
+   </context-param>
+   <context-param>
+     <param-name>org.apache.myfaces.ERROR_TEMPLATE_RESOURCE</param-name>
+     <param-value>META-INF/rsc/mycustom-template-error.xml</param-value>
+   </context-param>
+ }}}
+ === 
  === Using servlets ===
  Mert Caliskan ( describes
an approach which wraps the JSF servlet with a new servlet which delegates to the faces servlet
but handles uncaught exceptions allowing the developer to redirect to a custom error page.

View raw message