【问题标题】:How to call p:dialog from JSF Backing bean如何从 JSF Backing bean 调用 p:dialog
【发布时间】:2014-08-28 18:55:53
【问题描述】:

当我调用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();");
}

【问题讨论】:

  • 如果您使用 PrimeFaces 5,您需要执行 PF('dlg1').show()
  • 支持 bean 上的方法除了执行 javascript 调用没有其他功能吗?请改用onclick
  • RevanProdigalKnight,你的建议奏效了。谢谢

标签: jsf


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-17
    • 2014-08-11
    • 1970-01-01
    • 2011-08-27
    • 1970-01-01
    • 1970-01-01
    • 2011-02-02
    • 1970-01-01
    相关资源
    最近更新 更多