You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Hampus Wingren <ca...@bredband.net> on 2011/09/13 21:27:05 UTC

showing view on exception

Hi,

 

Does anyone know how I could show my own view (in production) and the
myfaces error view (in development) when an exception is thrown. I´m in a
portlet environment and would like to show a customized view in the portlet
when an error occur.

 

Regards,

Hampus


Re: showing view on exception

Posted by Michael Kurz <mi...@gmx.at>.
Hi,

I'm no expert on portlets, but the basic idea in JSF 2.0 would be to write a custom exception handler. In its handle() method you can for example make a redirect to your error page. You can make this redirect depending on the project stage:

FacesContext.getCurrentInstance().isProjectStage(ProjectStage.Production) 

Otherwise (in stage Development) just let the default (decorated) ExceptionHandler do the work.

lg
Michi


Write your own exception handler and in its handle() method
Am 13.09.2011 um 21:27 schrieb Hampus Wingren:

> Hi,
> 
> 
> 
> Does anyone know how I could show my own view (in production) and the
> myfaces error view (in development) when an exception is thrown. I´m in a
> portlet environment and would like to show a customized view in the portlet
> when an error occur.
> 
> 
> 
> Regards,
> 
> Hampus
>