【发布时间】:2013-07-02 16:58:06
【问题描述】:
编辑:另一种解决方案Updating ui:defined form content from Master template (JSF & Primefaces)
首先,对不起我的英语,我是这些该死的单语法语中的一员。
我遇到了这个经典错误:javax.faces.FacesException: 找不到从“formInscription:validerButton”引用的标识符为“:formWaitingList”的组件。
我知道为什么会这样,但我不知道如何解决。
我在页脚中有一个连接表单。我想更新页面 rankMe.xhtml 中呈现的命令按钮。此页面定义 template.xhtml 的 ui:composition “内容”。 当我在带有命令按钮的页面上时,我没有错误并且渲染工作完美。但是当我在像 index.xhtml 之类的另一个页面上时(也定义了 template.xhtml 的内容),Glassfish 抛出了这个异常,我想这是完全标准的导致其他内容 (rankMe.xhtml) 未加载到实际视图中。
我怎样才能避免这个异常?如果用户不在实际的 rankMe.xhtml 页面上,我可以在所有页面中复制我的命令按钮并隐藏,但这对我来说也不是一种干净的方式。
谢谢
这里是代码:
template.xhtml:
<h:body>
<ui:insert name="content" >
</ui:insert>
<ui:insert name="footer" >
<ui:include src="../template/footer.xhtml"></ui:include>
</ui:insert>
</h:body>
footer.xhtml:
<h:body>
<h:form id="formInscription">
<p:commandButton id="validerButton" update=":formWaitingList" ajax="true"/>
</h:form>
</h:body>
index.xhtml:
<h:body>
<ui:composition template="/template/template.xhtml">
<ui:define name="content">
Lorem ipsum ...
</ui:define>
</ui:composition>
</h:body>
rankMe.xhtml:
<h:body>
<ui:composition template="/template/template.xhtml">
<ui:define id="rankMe" name="content">
<h:form id="formWaitingList">
<h:commandButton id="Join"
rendered="#{connexion.connected}"
value="Join"/>
</h:form>
</ui:define>
</ui:composition>
</h:body>
【问题讨论】:
-
哦,好像话题已经发过了:stackoverflow.com/questions/9263193/…
标签: templates jsf rendering updates identifier