做了如下修改你的代碼:
添加mybutton
更新屬性和更改{#myBean.isValid}
爲#{myBean.isValid}
和你最好改變oncomplete
到onsuccess
<p:commandButton id="mybutton" value="Save"
actionListener="#{myBean.saveStg}"
update="growl,stg_panel,stg,mybutton"
onsuccess="if(#{myBean.isValid}){confirmation.hide()}else{confirmation.show()}" />
BTW在這裏的附加簡單的工作例如:
<h:body>
<h:form prependId="false">
<h:panelGrid>
<p:commandButton id="basic" update="basic" value="Basic"
actionListener="#{myBean.lalala}"
onsuccess="if(#{myBean.evenNumber}){dlg1.show();}else{dlg1.hide();}"/>
</h:panelGrid>
<p:dialog id="basicDialog" header="Basic Dialog" widgetVar="dlg1">
<h:outputText value="Resistance to PrimeFaces is futile!" />
</p:dialog>
</h:form>
</h:body>
豆碼
。 。 。
boolean evenNumber;
public boolean isEvenNumber() {
return evenNumber;
}
public void setEvenNumber(boolean evenNumber) {
this.evenNumber = evenNumber;
}
public void lalala(ActionEvent actionEvent) {
evenNumber = !evenNumber;
}
。 。 。
沒關係,我以前試過。但是,謝謝。 – aylak 2012-03-21 15:03:13
這很有趣,因爲沒有任何變化......無論如何它仍然關閉對話框。 – aylak 2012-03-21 15:12:16
謝謝,但我的問題依然存在。 – aylak 2012-03-22 08:43:56