我無法在p:對話框中執行h:form的ajax更新。這是我的xhtml的設計。我沒有嵌套表單。PrimeFaces p:對話框中的ajax更新不起作用
MainPage.xhtml有相應的managedBean - > MainPageBean。
SearchView.xhtml包含managedBean - > searchViewBean。
MainPage.xhtml
3210searchView.xhtml
<h:form prependId='false' id='sv_dataForm'>
...
<p:messages id="sv_messagesId" for="errorMessages" closeable="true" />
<p:inputText value="#{searchViewBean.lastName}" id="lastName" required="true" />
<p:commandButton value="Search" action="#{searchViewBean.search}" update=":sv_dataForm" ajax="true" />
<h:outputText value='#{searchViewBean.numberOfCustomers}' />
...
</h:form>
當MainPage.xhtml一個按鈕被點擊它顯示一個p:對話框。 p:對話框包含SearchView.xhtml。 SearchView.xhtml包含一個表單。當對姓氏進行簡單搜索時,numberOfCustomers被確定。當我調試代碼時,我可以在searchViewBean的numberOfCustomers中看到值,但是p:dialog沒有更新。但是,如果我有任何驗證錯誤,我可以看到p:消息得到顯示。我不知道爲什麼p:對話框正在更新。如果我做錯了,請告訴我。
謝謝。
嗨Konum我沒有嵌套形式。其實我發現這個問題,但stackoverflow不允許我回答我自己的問題,因爲我沒有足夠的聲譽。 – sreekarN
Ups,我不知道爲什麼我在那裏看到嵌套窗體。很高興你得到它的工作。 –