I am using Spring MVC with Primefaces/JSF as the VIEWER and Spring Webflow as the CONTROLLER and I am having the following problem:
I am trying to send a AJAX event with the primefaces component commandButton where my flow have a transition to a method that are throwing a null pointer exception. The first request everything works fine! The response is a 500 HTTP Status, the second request the method don't execute which causes a 200 HTTP Status response. All consecutive actions follow the same pattern, work and don't work. Going more deeper into the code I found out that in the method JsfView.processUserEvent (where the Jsf Lifecycle is executed) the instruction facesContext.getRenderResponse() return true when everything is working and false when not. So I investigated why this was happening and understood that in the end of the Jsf Lifecycle this flag is set to true (ok, the faces is telling that the render response phase was executed already) but when the next ajax request arrives this flag is true and the JSF Lifecycle don't run because the method ViewState.handleEvent think that there is nothing to be handled and do nothing.
I didn't find out any information about how to handler exceptions on business code from AJAX requests (i know if there is no ajax request you can call a redirect and everything will work fine, but with ajax request the whole page will be refreshed and that is not the behaviour i am hoping from a ajax request. Please some one could help me? My scenario is describe above:
JSF/Primefaces:
<p:commandButton value="Ajax Request" action="TX1" ajax="true" />
Flow:
<transition on="TX1">
<evaluate expression="testPopupMB.nullPointerException()"/>
</transition>
Business Class:
public void nullPointerException() {
throw new NullPointerException("null");
}
Output:
- 500 (Internal Server Error)
- 200 (OK)
- 500 (Internal Server Error)
- 200 (OK)
versions of used technologies: primefaces 3.6-SNAPSHOT, spring webflow 2.3.1, JSF Mojarra 2.1.7 and springframework 3.1.2 Thank you for your time