2014-08-28 48 views
0

當我打電話showMessage()方法我得到這個錯誤:如何撥打號碼:對話框從JSF支持bean

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

如果你使用PrimeFaces 5您需要執行'PF( 'DLG1')顯示()' – RevanProdigalKnight 2014-08-28 19:03:05

+0

背襯上的方法 - 除了執行JavaScript調用沒有其他功能?改爲使用'onclick'。 – dognose 2014-08-28 19:16:39

+0

RevanProdigalKnight,你的建議工作。謝謝 – unleashed 2014-08-28 19:23:29

回答

0

在PrimeFaces 5您需要執行PF('dlg1').show() - 。(感謝RevanProdigalKnight)