jsf - Application does not render "PrimeFaces" components -
my jsf application not render "primefaces components". have seen many topics these problem none helped me.
here artefacts:
pom.xml
<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.jsf.wcanatto.loja_games</groupid> <artifactid>loja_games</artifactid> <packaging>war</packaging> <version>1.0-snapshot</version> <name>loja_games maven webapp</name> <url>http://maven.apache.org</url> <repositories> <repository> <id>prime-repo</id> <name>primefaces maven repository</name> <url>http://repository.primefaces.org</url> <layout>default</layout> </repository> </repositories> <properties> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependencies> <dependency> <groupid>org.primefaces</groupid> <artifactid>primefaces</artifactid> <version>3.4.2</version> </dependency> <dependency> <groupid>org.primefaces.themes</groupid> <artifactid>all-themes</artifactid> <version>1.0.9</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>com.sun.faces</groupid> <artifactid>jsf-api</artifactid> <version>2.2.0</version> </dependency> <dependency> <groupid>com.sun.faces</groupid> <artifactid>jsf-impl</artifactid> <version>2.2.0</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>5.0.0.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>5.0.0.final</version> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.6</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-core</artifactid> <version>2.3</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.12</version> </dependency> </dependencies> <build> <finalname>loja_games</finalname> </build> </project>
web.xml
<!doctype web-app public "-//sun microsystems, inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>archetype created web application</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> <!-- jsf mapping --> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <!-- map these files jsf --> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> </web-app>
index.xhtml
<?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> </h:head> <h:body> <h1>hello world primefaces</h1> <h:form> <p:editor value="test" /> </h:form> </h:body> </html>
when acces page browser "primefaces" componentes not showed.
primefaces 3.4.2 not jsf 2.2 compatible. change jsf-impl
, jsf-api
use version 2.1 instead , change web.xml
use version 2.5 dtd.
change jsf version in pom.xml :
<dependency> <groupid>com.sun.faces</groupid> <artifactid>jsf-api</artifactid> <version>2.1.19</version> </dependency> <dependency> <groupid>com.sun.faces</groupid> <artifactid>jsf-impl</artifactid> <version>2.1.19</version> </dependency>
update web.xml version 2.5 , turn on jsf development mode
<?xml version="1.0" encoding="iso-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>archetype created web application</display-name> <context-param> <param-name>javax.faces.project_stage</param-name> <param-value>development</param-value> </context-param>
Comments
Post a Comment