我正在努力不在某些条件下显示对话框。 我想做什么:从Invoice.xhml页面,按下一个命令按钮(仅显示给管理员)。按下此按钮后,一个功能检查是否已经创建了发票。
出于某种原因,它永远不会以我想要的方式运作。当我检查调试器时,我的视图返回false但显示对话框
<p:commandButton value="Create Invoice" style="background-color:#4EC873; width: 160px; margin-top: 10px;" id="createoffer"
actionListener="#{invoiceView.createInvoice}" oncomplete="{ PF('dlg1').show(); }" rendered="#{InvoiceView.buttonIsDisplayed()}" ajax="true" />
<p:dialog rendered="#{invoiceView.popupDisplay()}" closable="true" header="Hello" widgetVar="dlg1" modal="true" height="80" resizable="false" closeOnEscape="true" >
<h:form id="commentdialog">
<h:outputText value="Invoice has already been created"/>
<br />
</h:form>
</p:dialog>
InvoiceView:
public boolean popupDisplay() {
Invoice invoice = new Invoice();
invoice = invoiceDB.getInvoice(this.selectedCar.getInvoice());
if (invoice == null || invoice.getId() == null) {
return false;
} else {
return true;
}
可能出现什么问题?