I've been struggling with this for a while, I hope someone can help me.
I have this code working using JSF-2 (taken from a solution given by BalusC in this question):
<h:panelGroup id="content" layout="block">
<h:form id="contentform">
<h:panelGroup rendered="#{bean.page == 'include1'}">
<ui:include src="include1.xhtml" />
</h:panelGroup>
<h:panelGroup rendered="#{bean.page == 'include2'}">
<ui:include src="include2.xhtml" />
</h:panelGroup>
<h:panelGroup rendered="#{bean.page == 'include3'}">
<ui:include src="include3.xhtml" />
</h:panelGroup>
</h:form>
</h:panelGroup>
Then, inside each page included, I have something like this (also working):
<h:outputText value="Name: "/>
<h:inputText value="#{itemsBean.item.name}" id="name" required="#{not empty param[save.clientId]}"/>
<h:outputText value="Desc: "/>
<h:inputText value="#{itemsBean.item.description}" id="desc" required="#{not empty param[save.clientId]}"/>
<h:commandButton binding="#{save}" label="Save" actionListener="#{itemsBean.save}">
<f:ajax render=":contentForm" execute="name desc"
</h:commandButton>
<h:dataTable value="#{itemsBean.itemsList}" var="item">
<h:column>
<h:outputText value="#{item.name}" />
</h:column>
<h:column>
<h:outputText value="#{item.description}" />
</h:column>
</h:dataTable>
Now the problem.
It starts when I try to use PrimeFaces for inluded pages, specifically when I replace the <h:commandButton...
with:
<p:commandButton binding="#{save}" value="Save" actionListener="#{itemsBean.save}">
<p:ajax update=":contentForm" process="name desc" />
</p:commandButton>
The result is that the form is submited multiple times and even the input fields from the other included (not rendered) pages are processed (total mess).
I'm using:
JSF 2.1.1 Mojarra implementation.
PrimeFaces 3.0-RC2.
Tomcat 7.
(Tomcat and JSF are the ones that come with NetBeans 7.0.1)
Thank you in advance.