3 Replies Latest reply on Sep 8, 2011 10:44 AM by Stan Silvert

    Is there Global Exception handler in JSF 2.0?

    Vikas V Newbie



      Am using JSF 2.0 , Jboss AS 6.0, GateIn portal 3.1


      In my bean, based on some checks am navigating to respective pages by configuring in faces-config.xml.


      Suppose there are some unhandled exceptions (For eg Index out of bounds) for which navigation is not defined in faces-config.xml,


      then I need to display a customized message to user (say 'Sorry your request cannot be processed now').


      Struts 2 provides Global exception handler, where if a page is not found then define one error page and display that for all unhandled exceptions.


      Is there a Global exception handler in JSF 2.0 ?


      One option is to configure in Portal saying if a page is not found then display error page. But this is configured when my server is down with message


      'Page is under maintenance' and it cannot be displayed for unhandled exceptions in my code.


      Problem here is when exception is not handled, control will not go to faces-config.xml to find a page.


      How this can be achieved?