如何从JSF Backing bean调用p:对话框

时间:2014-08-28 18:55:54

标签: jsf

当我调用showMessage()方法时,我收到此错误:

MalformedXML : 'dlg1' is undefined

这是我的代码:

addApplicant.xhtml

<p:dialog id="record_error" header="Applicant" widgetVar="dlg1" minHeight="40" >
  <h:outputText value="Applicant already exists" />
</p:dialog>

addApplicantBacking.java:

public void showMessage() {     
  RequestContext context = RequestContext.getCurrentInstance();
  context.execute("dlg1.show();");
}

1 个答案:

答案 0 :(得分:0)

在PrimeFaces 5中,您需要执行PF('dlg1').show() - (感谢RevanProdigalKnight)