我知道有几个堆栈主题与我的完全相同,但在Chrome控制台中无法解决该问题。
请注意,目前显示的内容正确,我只能解决项目中的任何问题。
按F12我收到此错误:
未捕获的ReferenceError:未定义PrimeFaces
这是我的页面:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<h1 class="title ui-widget-header ui-corner-all"><p:spacer width="100" height="10" />PrimeFaces Test</h1>
<title><ui:insert name="title">PrimeFaces Test</ui:insert></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body>
<h:form>
<h:selectOneMenu binding="#{bindingTestClass.menu}" />
<h:panelGroup binding="#{bindingTestClass.panelGroup}"/>
</h:form>
</h:body>
</html>
那是我的Pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.itcuties.examples.simplejsf</groupId>
<artifactId>simple-jsf2-with-primefaces</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>simple-jsf2</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- Primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.2</version>
</dependency>
<!-- JSF 2 API -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.10</version>
</dependency>
<!-- Themes All-in-One! -->
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>primefaces-repository</id>
<name>Primefaces repository</name>
<url>http://repository.primefaces.org</url>
</repository>
</repositories>
<build>
<finalName>jsf2</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
我补充说,Google Developer Tools网络没有显示任何可疑内容。
绑定工作正常。
谢谢!