我想要一个条件语句在我的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>
(同一个对话框与“编辑”对话框)
它解决你的问题吗?!? –