【发布时间】:2015-05-06 06:11:37
【问题描述】:
我想从单个按钮显示不同的对话框取决于 backingbean 计算。就像显示一条消息“已经支付了账单”,如果客户输入重复的账单号,如果账单号没问题,则显示“账单已成功支付”。我怎样才能做到这一点?
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>
【问题讨论】:
标签: jsf primefaces