EDIT : 別の解決策マスター テンプレート (JSF & Primefaces) からの ui:defined フォーム コンテンツの更新
そもそも、私の英語で申し訳ありませんが、私はこれらの気の毒なモノラル フランス語の 1 つです。
この古典的なエラーがあります: javax.faces.FacesException: Cannot find component with identifier ":formWaitingList" referenced from "formInscription:validerButton" .
なぜこれが起こっているのかはわかっていますが、それを修正する方法はわかりません。
フッターに接続フォームがあります。ページrankMe.xhtmlでレンダリングされた commandButton を更新したいと考えています。このページは、 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>
ランクMe.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>