Reputation: 61
When using
<p:ajaxExceptionHandler type="java.lang.Exception" >
or
<p:ajaxExceptionHandler type="java.lang.Throwable" >
the primefaces' exceptions handling mecanismm seems not working !!
My question is how can i use primefaces ajaxExceptionHandler to handle all the inhereted exceptions, no matter what exactely it is (NullPointerException
, OutOfBoundException
..etc) ?
i just have to mention that the <p:ajaxExceptionHandler>
works fine when i use it with
javax.ejb.EJBException
, java.lang.NullPointerException
or other custom Exceptions.
Upvotes: 4
Views: 6029
Reputation: 1263
Remove the type declaration so it's <p:ajaxExceptionHandler />
Also Omnifaces is good but, but obviously requires a new jar dependency, if PF now has the ability you may find it works for you. I however, like that Omnifaces is configured in web.xml and you can set it up to handle/cater for ajax and non ajax request with a page redirect.
This is new to PF5 so any issues let them know.
For more info see for usage Jsf Ajax Error Handler Usage
If not defining a type doesn't work, ensure that in your WEB.XML
has defined the error page for java.lang.Exception
- if it's not defined there the type definition in your pages won't work.
After reading: PF5UG
I'm still not convinced either however - I will do some checks when i get home,.
Upvotes: 5