Jsf 调用action方法后,根据输入值显示确认消息
如果文本框中输入的值不符合预期,我需要从backingbean中的save方法调用确认消息 确认对话框如下所示Jsf 调用action方法后,根据输入值显示确认消息,jsf,primefaces,dialog,confirm,Jsf,Primefaces,Dialog,Confirm,如果文本框中输入的值不符合预期,我需要从backingbean中的save方法调用确认消息 确认对话框如下所示 <p:confirmDialog id="confirmDialog" header="Confirmation" global="true" showEffect="fade" hideEffect="explode" widgetVar="Confirmation" message="Are you sure?" icon="ui-icon-alert"> &l
<p:confirmDialog id="confirmDialog" header="Confirmation" global="true" showEffect="fade" hideEffect="explode" widgetVar="Confirmation" message="Are you sure?" icon="ui-icon-alert">
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" action="#{MBean.Save()}" icon="ui-icon-check" />
<p:commandButton value=No" type="button" styleClass="ui-confirmdialog-no" > icon="ui-icon-close" />
</p:confirmDialog>`
但是我无法在JSF页面中调用确认消息。有人知道为什么吗?确认对话框用于预先询问确认是否应该调用支持bean中的业务方法
如果您想在调用backingbean中的业务方法或更具体地说从中调用业务方法后显示一个对话框作为确认,请使用普通对话框。您使用的是什么版本的primefaces?如果它是PF>=4.x,那么您将需要context.execute(“PF('Confirmation').show();”)您希望显示哪种消息?什么意思不是预期的?你能再具体一点吗?
RequestContext context = RequestContext.getCurrentInstance();
context.execute("Confirmation.show()");