我想要一個條件語句在我的commandbutton(Primefaces 6.0)中,如果我的java方法返回false或true,它應該顯示一個對話框。類似的東西:primefaces commandbutton條件語句
<p:commandButton onclick="(myJavaMethod) ? deleteDialog.show() : confirmDialog.show()">
<p:confirm header="Deleting Branch" message="Do you want to delete the Branch?"/>
</p:commandButton>
myJavaMethod返回false,如果我不能刪除它和真正的,如果我可以將其刪除。
我的對話框如下圖所示:
<!-- DELETE-DIALOG -->
<p:dialog id="deleteDialog" widgetVar="deleteDialog">
<h:form id="deleteDialogForm">
<h:panelGrid columns="1" border="0">
<p:outputLabel value="Branch could not be deleted"/>
<p:commandButton icon="ui-icon-close" id="doCloseDialog" oncomplete="PF('deleteDialog').hide()" value="OK" class="btn-confirm"/>
</h:panelGrid>
</h:form>
</p:dialog>
(同一個對話框與「編輯」對話框)
它解決你的問題嗎?!? –