p:dialog typeerror-pf-is-undefined 尝试使用 widgetvar 显示时

p:dialog typeerror-pf-is-undefined when trying to show using widgetvar

我试图从网页或 bean 中显示一个对话框。在任何一种情况下,它都会给出上述错误,并且似乎无法在 PF 中找到该组件。我使用的是 PrimeFaces 5.2,我似乎没有讨论过的多版本问题

我在下面粘贴了相关的 xhtml 代码 - 当我尝试从 bean 中调用它时,会发生完全相同的行为:

RequestContext.getCurrentInstance().execute("PF('dlgTask').show();");
    <ui:composition template="template-restricted.xhtml">
        <ui:define name="body_content">
                <div id="title" class="sl-title">#{text['project.title']}   </div>
                <p:dialog
                    id="taskDialog"
                    widgetVar="dlgTask" 
                    modal="true"
                    closeOnEscape="true">
                <h:form id="taskDialogForm">
                    <p:panelGrid columns="1" layout="grid">
                        <p:outputLabel for="taskName" value="#{text['name']}" />
                        <p:inputText 
                            id="taskName" 
                            value="#{editProject.editTask.name}" />
                    </p:panelGrid>
                </h:form>
                </p:dialog>
                <p:commandButton      
                    title="#{text['project.task.new']}"
                    disabled="#{not editProject.canEditProject}"
                    action="#{editProject.createNewTask}"
                    process="@form"
                    update="@form"
                    oncomplete="PF('dlgTask').show();"
                    icon="fa fa-plus" />

这是由声明了 jquery.js 库的菜单部分中不相关的 javascript 引起的。当我删除有问题的导入时,所有奇怪的 Primefaces 错误都消失了。似乎声明其他 jquery 库会干扰 Primefaces 代码。