jsf 2 - Uncaught Exception Handling in JSF -
i trying create filter handle exceptions (see handling uncaught exception in jsf)
public void dofilter(servletrequest request, servletresponse response, filterchain chain) throws ioexception, servletexception {       try {           log.info("check filter running");             chain.dofilter(request, response);         } catch (exception e) {             log.error("uncaught exception",e);             request.setattribute("exception", e);             request.getrequestdispatcher("/error.xhtml").forward(request, response);         } } i execute following method:
    <p:commandbutton value="dispatch order" update="@form"         action="#{orderbean.dispatchorder()}">     </p:commandbutton> however, no exception handled.
i see error in logs:
may 21, 2013 6:04:32 pm com.sun.faces.lifecycle.invokeapplicationphase execute warning: #{orderbean.dispatchorder()}: myexception..... what doing wrong?
that old question targeted on jsf 1.x , answer not applicable when send jsf 2.x ajax request. filter invoked when add ajax="false" <p:commandbutton> or use standard jsf <h:commandbutton> without <f:ajax>. in order handle exceptions on ajax requests, need custom exceptionhandler. 
Comments
Post a Comment