私はしばらくこの問題に取り組んできました。プライムフェイスを使用してページから複数のサブミットが動的に含まれています。ajax
私はこのコードはJSF-2(this questionでBalusCによって与えられた溶液から採取した)を使用して作業を持っている:
<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>
そして、含まれる各ページの内部に、私はこのような何か(も作業)を有する:
<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>
問題になりました。
私はinludedページに対してPrimeFacesを使用しようとするとそれは、始まり私は<h:commandButton...
を交換する際に、特に:(ない
<p:commandButton binding="#{save}" value="Save" actionListener="#{itemsBean.save}">
<p:ajax update=":contentForm" process="name desc" />
</p:commandButton>
結果はフォームが複数回submitedや他からも、入力フィールドが含まれていることですレンダリングされた)ページが処理されます(完全な混乱)。
私は以下を使用しています:
JSF 2.1.1 Mojarraの実装。
PrimeFaces 3.0-RC2。
Tomcatは7
'binding =#{save}'は、押されたボタンに依存するようにするための回避策です。 '#{itemsBean.save} 'とは関係ありません。[この質問を参照](http:// stackoverflow。 com/a/8371726/1079323)をご覧ください。 'binding =#{save}'が問題を引き起こしていたので、あなたの答えは正しい方向です: 私は、バインディング=#{save} 'で同じ名前( 'save')を使っていました。他のページがレンダリングされなかったとしても、それは問題の原因でした。だから今それは解決されました。 ご協力いただきありがとうございます。 – Roteke