I am using JSF2 facelets.
I am trying to insert a piece of code from one page into the other using <ui:composition> and <ui:insert> tags.
I have page A, which includes code from page B.
<h:form id="formIdPageA">
…
<h:form id="formIdPageB">
The problem seems to be form id, since I get error:
System error: Cannot find component with identifier ":formIdPageA:fileListId" in view.
Here is a piece of code from page B that gets inserted into page A. Here ids can be seen:
<tr>
<td colspan="2">
<p:selectOneMenu id="locationId" value = "#{PFMultiFileSelectMgmtBean.selectedLocationId}">
<p:ajax update=":formIdPageA:fileListId" listener="#{PFMultiFileSelectMgmtBean.LocationChangeEvent}"/>
<f:selectItems value="#{PFJobMgmtBean.outputLocationList}"/>
</p:selectOneMenu>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<p:selectManyCheckbox id="fileListId" value="PFMultiFileSelectMgmtBean.selectedFiles" layout="pageDirection">
<f:selectItems value="#{PFMultiFileSelectMgmtBean.fileNames}" />
</p:selectManyCheckbox>
</td>
</tr>
And this is how I insert it in page A:
<p:dialog id="basicDialog" header="Select Files" widgetVar="dlgMultiFileSelect" modal="true" height="500" width="500" resizable="false">
<ui:insert>
<ui:include src="/pageB.xhtml"/>
</ui:insert>
</p:dialog>
Does anyone know if it is possible to include page like this? Does <ui:composition> go before body tab or after in page B? Is this ok:
<body>
<f:view>
<h:form id="formIdPageB">
<ui:composition>...
?
Ok, found it:
The problem was that I used PrimeFaces component <p:dialog> and placed it in page A outside <h:form> and outside <body>, like this:
</h:form>
</f:view>
</body>
<p:dialog...>
<ui:include src="/pageB.xhtml"/>
</p:dialog>
That seems to be wrong. Now I moved <p:dialog> inside form and all is ok.
The problem was that I used PrimeFaces component and placed it in page A outside and outside , like this:
That seems to be wrong. Now I moved inside the form and all is ok.