Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/420.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未捕获引用错误:$未定义JSF Primefaces(h:包括头部)_Jsf_Primefaces_Jsf 2 - Fatal编程技术网

未捕获引用错误:$未定义JSF Primefaces(h:包括头部)

未捕获引用错误:$未定义JSF Primefaces(h:包括头部),jsf,primefaces,jsf-2,Jsf,Primefaces,Jsf 2,我有一个简单的JSF页面,显示来自primefaces的文本编辑器。 但是,不会显示文本编辑器。当我在chrome中检查F12时,我看到多个错误,第一个是: core.js.xhtml:2 Uncaught ReferenceError: $ is not defined at Object.resolveUserAgent (core.js.xhtml:2) at Object.init (core.js.xhtml:2) at core.js.xhtml:2 其他是未捕获的TypeErro

我有一个简单的JSF页面,显示来自primefaces的文本编辑器。 但是,不会显示文本编辑器。当我在chrome中检查F12时,我看到多个错误,第一个是:

core.js.xhtml:2 Uncaught ReferenceError: $ is not defined
at Object.resolveUserAgent (core.js.xhtml:2)
at Object.init (core.js.xhtml:2)
at core.js.xhtml:2
其他是未捕获的TypeError:无法读取未定义的属性“Tag from Primefaces”

我读了这些问题:/,但我确实有一个问题。 我错过了什么

My page index.xhtml:

<h:html xmlns="http://www.w3.org/1999/xhtml"
xmlns:b="http://bootsfaces.net/ui"
xmlns:p="http://primefaces.org/ui"  
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <h:outputStylesheet library="css" name="style.css"  />
    <h:outputScript library="js" name="script.js" />
</h:head>
<h:body>
    <p:textEditor value="#{textEditorController.text}" height="300" style="margin-bottom:10px"/>
    <p:commandButton value="Submit" action="#{textEditorController.submit}"/>
</h:body>
</h:html>
My web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
  <display-name>MusiglabelWEB</display-name>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <param-name>facelets.SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
  </context-param>
</web-app>
我使用多项目WEB、JPA、EJB、EAR,如果这很重要的话

WEB项目中包含的库: Primefaces 6.1已下载
Bootsfaces 1.1.1下载了

这是PrimeFaces中的一个bug,我注册了它。当p:textEditor是最终视图中PrimeFaces组件的第一个时,它会显示

要解决此错误,只需在其之前添加一些其他组件,您可以使其不呈现,否则不会影响页面:

<p:inputText rendered="false" />
<p:textEditor />
我也有同样的问题。 通过导入jquery和jquery ui解决了如下问题

...
    <h:head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
</h:head>
...

第一个js错误的堆栈是什么?如果删除会怎么样?您在浏览器控制台中看到加载了什么JS。。。请做一些调查…堆栈添加。删除我自己的script.js不会改变它。我不知道如何查看加载的JS,但如果你指的是源选项卡中列出的JS:jquery.JS、jquery-plugins.JS、texteditor.JS。components.js,core.jsSo,您从源代码构建PrimeFaces吗?或者它到底是如何集成到您的项目中的?如果您使用commandXXX组件,则始终需要一个表单在其他页面中显示错误的解决方案版本,并且容易出错