0
我想显示不同的对话框从一个单一的按钮取决于backingbean计算。如显示一个味精“如果已经支付账单”,如果客户输入一个重复的账单号码,如果账单号码比“账单已经支付成功”这样的显示好。我怎样才能做到这一点?primefaces:如何设置动态oncomplete事件值,如oncomplete =“#backingbean.oncomplete”
backingbean类:
private String oncomplete="";
public String getOncomplete() {
return oncomplete;
}
public void setOncomplete(String oncomplete) {
this.oncomplete = oncomplete;
}
public void bill_fees_calculation(){
if(bill_no=="wrong"){
oncomplete = "PF('wrongDialog').show()";
}
else{
oncomplete = "PF('rightDialog').show()";
}
}
在我的XHTML:
<p:commandButton oncomplete="#{backingbean.bill_fees_calculation}" icon="ui-icon-search" title="View" update=""/>
<p:dialog header="Bill Info" widgetVar="wrongDialog" modal="false" showEffect="fade" hideEffect="explode" resizable="false" closable="true" closeOnEscape="true">
<p:outputPanel id="billDetail" autoUpdate="true" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputText value="Output:" />
<h:outputText value="Bill no has been paid already" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
<p:dialog header="Bill Info" widgetVar="rightDialog" modal="false" showEffect="fade" hideEffect="explode" resizable="false" closable="true" closeOnEscape="true">
<p:outputPanel id="billDetail" autoUpdate="true" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputText value="Output:" />
<h:outputText value="Bill no has been paid successfully" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>