Jsf 2 primefaces对话框不工作

Jsf 2 primefaces对话框不工作,jsf-2,primefaces,Jsf 2,Primefaces,我正在尝试复制primefaces ajax对话框形式,就像primefaces showcase中一样 我的JSF代码片段如下 <h:body> <p:commandButton id="showDialogButton" type="button" value="Show" onclick="PF('dlg').show()" /> <p:dialog header="Enter FirstName" widgetVar="dlg" ap

我正在尝试复制primefaces ajax对话框形式,就像primefaces showcase中一样

我的JSF代码片段如下

<h:body>  

<p:commandButton id="showDialogButton" type="button" value="Show"  
    onclick="PF('dlg').show()" />  

<p:dialog header="Enter FirstName" widgetVar="dlg" appendToBody="true"  
    resizable="false">  
    <h:form id="form">  

        <h:panelGrid columns="2" style="margin-bottom:10px">  
            <h:outputLabel for="firstName" value="firstName:" />  
            <p:inputText id="firstName" value="#{backingBean.firstName}" />  
        </h:panelGrid>  

        <p:commandButton id="submitButton" value="Submit" update=":display"  
            oncomplete="PF('dlg').hide();" />  

    </h:form>  
</p:dialog>  

<p:outputPanel id="display" style="display:block;margin-top:10px;">  
    <h:outputText id="name" value="Hello #{backingBean.firstName}"  
        rendered="#{not empty backingBean.firstName}" />  
</p:outputPanel>  

单击提交按钮时未显示任何对话框:(.我还包括了appendToBody=“true”,但没有结果。在ie中,我得到的javascript错误为“预期对象”。请帮助我解决此问题。

您使用哪个版本的primefaces

如果使用Primefaces 3.5或更高版本:

<p:commandButton id="showDialogButton" type="button" value="Show"  
    onclick="dlg.show()" />  

对于Primefaces 4.0:

<p:commandButton id="showDialogButton" type="button" value="Show"  
    onclick="PF('dlg').show()" />


在我的例子中,我在标题中有一个指向jquery的脚本链接。我删除了它,primefaces开始正常工作

第二个是javascript调用吗?我只想知道这两个调用之间的区别。非常感谢Lamq。正如你提到的,我使用的是PF 3.5,这只能与onclick=“dlg.show()这里指定为
onclick
属性值的
JavaScript
派生方言的名称是什么?我只是在
PrimeFaces
中查找方言或表达式语言的名称。我使用PrimeFaces 3.5,但onclick=“dlg.show()”在IE10-11中不起作用。那么我该怎么办?
<p:commandButton id="showDialogButton" type="button" value="Show"  
    onclick="PF('dlg').show()" />