我正在使用JSF2 facelets。<ui:composition>在<body>之前还是之后?
我试图插入一段代码从一个页面到另一个使用<ui:composition>
和<ui:insert>
标签。
我有一个页面,其中包括来自网页B.
<h:form id="formIdPageA">
代码...
<h:form id="formIdPageB">
这个问题似乎是表单ID,因为我得到错误:
System error: Cannot find component with identifier ":formIdPageA:fileListId" in view.
这是从页面B的一段代码g ETS插入到页面A.这里IDS可以看出:
<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>
这就是我如何将它插入页面答:
<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>
有谁知道是否有可能包括网页这样吗? <ui:composition>
是在主体标签之前还是在B页之后?这是好的:
<body>
<f:view>
<h:form id="formIdPageB">
<ui:composition>...
?
好吧,发现:
的问题是,我使用PrimeFaces组件<p:dialog>
并把它放在网页A外<h:form>
内外<body>
,像这样:
</h:form>
</f:view>
</body>
<p:dialog...>
<ui:include src="/pageB.xhtml"/>
</p:dialog>
这似乎是错误。现在我移动了<p:dialog>
里面的形式,一切都好。
但是我试了一下,我得到错误:'系统错误:无法找到带有标识符的组件:formIdPageA:fileListId“in view.'嗯......任何想法?我如何参考表单组件? – Danijel
你可以尝试formIdPageA:fileListId删除:在开始。 –
刚试过,没有工作。我在其他地方使用':'并且工作,所以我也在这里使用它。 – Danijel