I have a problem with JSF 2. I am using Mojarra 2.1.14 with Primefaces 3.1.4
I have a page with two forms: formA and formB . Two forms contain each ViewState view in a hidden input field.
<h:form id="formA" binding="#{sessionBean.formA}">
<h:commandButton value="formA" action="#{sessionBean.actionA}">
<f:ajax/>
</h:commandButton>
</h:form>
<h:form id="formB" binding="#{sessionBean.formB}">
<h:commandButton value="formB" action="#{sessionBean.actionB}">
<f:ajax/>
</h:commandButton>
</h:form>
The user submits formA using an Ajax action. Inside the Java action, I explicitly update formA and formB (which are bound).
public void actionA(){
FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(formA.getClientId());
FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(formB.getClientId());
System.out.println("action A!!");
}
public void actionB(){
System.out.println("action B!!");
}
Ajax answers have HTML code for formA and formB (element) and ViewState.
JSF HTML formA formB ViewState : formA. formB ViewState.
formB Ajax. ViewState , postBack , renderResponse true RESTORE, INVOKE APPLICATION: . VIEW_STATE, sumbit formB, .
JSF 2? - ?
maven GitHub:
https://github.com/nithril/jsf-multiple-form
!