0 Replies Latest reply on Aug 26, 2010 2:54 AM by Julien Martin

    problem with facelets+richfaces+jsf2

    Julien Martin Expert

      Hello,

      I am trying to setup the following environment: richfaces3.3.3 +jsf2.0 +facelets. When I run my app, the facelets are not interpreted and are displayed as such in the browser source code view.

      Can anyone please help?

      thanks in advance,

      J.

       

       

      Here is my web.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" 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">
          <display-name>Site Jean-Baptiste Martin ${pom.version}</display-name>
          <context-param>
              <param-name>contextConfigLocation</param-name>
              <param-value>classpath:root-application-config.xml</param-value>
          </context-param>
          <context-param>
              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
              <param-value>.xhtml</param-value>
          </context-param>
          <context-param>
              <param-name>facelets.DEVELOPMENT</param-name>
              <param-value>false</param-value>
          </context-param>
          <context-param>
              <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
              <param-value>com.sun.facelets.FaceletViewHandler</param-value>
          </context-param>
          <context-param>
              <param-name>facelets.LIBRARIES</param-name>
              <param-value>/WEB-INF/jbm.taglib.xml</param-value>
          </context-param>
          <context-param>
              <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
              <param-value>false</param-value>
          </context-param>
          <context-param>
              <param-name>com.jeanbaptistemartin.static.url</param-name>
              <param-value>http://static.jeanbaptistemartin.com/sculptures</param-value>
          </context-param>
          <context-param>
              <param-name>com.jeanbaptistemartin.version</param-name>
              <param-value>${pom.version}</param-value>
          </context-param>
          <context-param>
              <param-name>facelets.SKIP_COMMENTS</param-name>
              <param-value>true</param-value>
          </context-param>
          <context-param>
              <param-name>facelets.REFRESH_PERIOD</param-name>
              <param-value>-1</param-value>
          </context-param>
          <context-param>
              <param-name>org.richfaces.ExcludeScripts</param-name>
              <param-value>Prototype,Scriptaculous,jQuery</param-value>
          </context-param>
          <context-param>
              <param-name>com.ocpsoft.pretty.BASE_PACKAGES</param-name>
              <param-value>com.jeanbaptistemartin.view</param-value>
          </context-param>
          <context-param>
           <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
           <param-value>true</param-value>
      </context-param>

       


          <listener>
              <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
          </listener>
          <listener>
              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
          </listener>

       

          <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>
          <servlet>
              <servlet-name>CaptchaServlet</servlet-name>
              <servlet-class>com.jeanbaptistemartin.util.CaptchaServlet</servlet-class>
          </servlet>
          <servlet>
              <servlet-name>DesinscriptionAbonneServlet</servlet-name>
              <servlet-class>com.jeanbaptistemartin.util.DesinscriptionAbonneServlet</servlet-class>
          </servlet>
          <servlet>
              <servlet-name>RedirigeVersSculptureServlet</servlet-name>
              <servlet-class>com.jeanbaptistemartin.util.RedirigeVersSculptureServlet</servlet-class>
          </servlet>
          <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.jsf</url-pattern>
          </servlet-mapping>
          <filter>
              <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
              <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
          </filter>
          <filter>
              <filter-name>Pretty Filter</filter-name>
              <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
          </filter>
          <filter>
              <filter-name>ajax4jsf</filter-name>
              <filter-class>org.ajax4jsf.Filter</filter-class>
              <init-param>
                  <param-name>forceparser</param-name>
                  <param-value>true</param-value>
              </init-param>
          </filter>
          <filter>
              <filter-name>DisableUrlSessionFilter</filter-name>
              <filter-class>com.jeanbaptistemartin.util.DisableUrlSessionFilter</filter-class>
          </filter>
          <filter-mapping>
              <filter-name>DisableUrlSessionFilter</filter-name>
              <url-pattern>/*</url-pattern>
          </filter-mapping>
          <filter-mapping>
              <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
              <url-pattern>/*</url-pattern>
          </filter-mapping>
          <filter-mapping>
              <filter-name>Pretty Filter</filter-name>
              <url-pattern>/*</url-pattern>
              <dispatcher>FORWARD</dispatcher>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>ERROR</dispatcher>
          </filter-mapping>
          <filter-mapping>
              <filter-name>ajax4jsf</filter-name>
              <servlet-name>Faces Servlet</servlet-name>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
              <dispatcher>INCLUDE</dispatcher>
          </filter-mapping>
          <servlet-mapping>
              <servlet-name>CaptchaServlet</servlet-name>
              <url-pattern>/CaptchaServlet</url-pattern>
          </servlet-mapping>
          <servlet-mapping>
              <servlet-name>DesinscriptionAbonneServlet</servlet-name>
              <url-pattern>/DesinscriptionAbonneServlet</url-pattern>
          </servlet-mapping>
          <servlet-mapping>
              <servlet-name>RedirigeVersSculptureServlet</servlet-name>
              <url-pattern>/RedirigeVersSculptureServlet</url-pattern>
          </servlet-mapping>
          <session-config>
              <session-timeout>30</session-timeout>
          </session-config>
          <welcome-file-list>
              <welcome-file>accueil.jsf</welcome-file>
          </welcome-file-list>
          <security-constraint>
              <display-name>jbmConstraint</display-name>
              <web-resource-collection>
                  <web-resource-name>jbmAll</web-resource-name>
                  <description/>
                  <url-pattern>/*</url-pattern>
                  <http-method>GET</http-method>
                  <http-method>POST</http-method>
                  <http-method>HEAD</http-method>
                  <http-method>PUT</http-method>
                  <http-method>OPTIONS</http-method>
                  <http-method>TRACE</http-method>
                  <http-method>DELETE</http-method>
              </web-resource-collection>
          </security-constraint>
          <security-constraint>
              <display-name>jbmConstraint</display-name>
              <web-resource-collection>
                  <web-resource-name>jbmAll</web-resource-name>
                  <description/>
                  <url-pattern>/*</url-pattern>
                  <http-method>GET</http-method>
                  <http-method>POST</http-method>
                  <http-method>HEAD</http-method>
                  <http-method>PUT</http-method>
                  <http-method>OPTIONS</http-method>
                  <http-method>TRACE</http-method>
                  <http-method>DELETE</http-method>
              </web-resource-collection>
          </security-constraint>
          <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>jbmRealm</realm-name>
          </login-config>
      </web-app>

       

      and my faces-config:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      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-facesconfig_1_2.xsd">
          <application>
              <!--<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>-->
              <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
              <resource-bundle>
                  <base-name>resources</base-name>
                  <var>msg</var>
              </resource-bundle>
              <resource-bundle>
                  <base-name>images</base-name>
                  <var>img</var>
              </resource-bundle>
              <locale-config>
                  <default-locale>fr</default-locale>
                  <supported-locale>fr</supported-locale>
                  <supported-locale>en</supported-locale>
              </locale-config>
          </application>
          <validator>
              <validator-id>adresseEmailValidator</validator-id>
              <validator-class>com.jeanbaptistemartin.util.AdresseEmailValidator</validator-class>
          </validator>
          <validator>
              <validator-id>captchaValidator</validator-id>
              <validator-class>com.jeanbaptistemartin.util.CaptchaValidator</validator-class>
          </validator>
          <converter>
              <converter-id>sculptureConverter</converter-id>
              <converter-class>com.jeanbaptistemartin.util.SculptureConverter</converter-class>
          </converter>
          <navigation-rule>
              <from-view-id>/WEB-INF/include/formulaire-contact.xhtml</from-view-id>
              <navigation-case>
                  <from-outcome>envoi-reussi</from-outcome>
                  <to-view-id>/WEB-INF/include/traitement-envoi-reussi.xhtml</to-view-id>
              </navigation-case>
          </navigation-rule>
          <navigation-rule>
              <from-view-id>/WEB-INF/include/formulaire-sculptures-pour-selection.xhtml</from-view-id>
              <navigation-case>
                  <from-outcome>succes</from-outcome>
                  <to-view-id>/WEB-INF/include/formulaire-traitement-mailing.xhtml</to-view-id>
              </navigation-case>
          </navigation-rule>
          <navigation-rule>
              <from-view-id>/WEB-INF/include/formulaire-traitement-mailing.xhtml</from-view-id>
              <navigation-case>
                  <from-outcome>succes</from-outcome>
                  <to-view-id>/WEB-INF/include/traitement-mailing-reussi.xhtml</to-view-id>
              </navigation-case>
          </navigation-rule>
          <navigation-rule>
              <from-view-id>/WEB-INF/include/formulaire-inscription.xhtml</from-view-id>
              <navigation-case>
                  <from-outcome>succes</from-outcome>
                  <to-view-id>/WEB-INF/include/traitement-inscription-reussi.xhtml</to-view-id>
              </navigation-case>
          </navigation-rule>

       

      </faces-config>

       

      and finally my pom:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <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.jeanbaptistemartin</groupId>
          <artifactId>jeanbaptistemartin</artifactId>
          <packaging>war</packaging>
          <version>1.3</version>
          <name>jeanbaptistemartin.com</name>
          <url>http://maven.apache.org</url>
          <dependencies>
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.4</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>com.ocpsoft</groupId>
                  <artifactId>prettyfaces-jsf2</artifactId>
                  <version>3.0.2-SNAPSHOT</version>
                 
              </dependency>
              <dependency>
                  <groupId>org.restfaces</groupId>
                  <artifactId>restfaces</artifactId>
                  <version>1.3.1</version>
                 
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-core</artifactId>
                  <version>3.5.4-Final</version>
                 
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-annotations</artifactId>
                  <version>3.4.0.GA</version>
                 
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-entitymanager</artifactId>
                  <version>3.4.0.GA</version>
                 
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-commons-annotations</artifactId>
                  <version>3.3.0.ga</version>
                 
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-validator</artifactId>
                  <version>4.0.2.GA</version>
                 
              </dependency>
              <dependency>
                  <groupId>javassist</groupId>
                  <artifactId>javassist</artifactId>
                  <version>3.4.GA</version>
              </dependency>
              <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-log4j12</artifactId>
                  <version>1.5.2</version>
              </dependency>

       


              <dependency>
                  <groupId>net.sf.ehcache</groupId>
                  <artifactId>ehcache</artifactId>
                  <version>1.5.0</version>
                 
              </dependency>
              <dependency>
                  <groupId>concurrent</groupId>
                  <artifactId>concurrent</artifactId>
                  <version>1.3.4</version>
                 
              </dependency>
              <dependency>
                  <groupId>javax.persistence</groupId>
                  <artifactId>persistence-api</artifactId>
                  <version>1.0</version>
                 
              </dependency>
              <dependency>
                  <groupId>log4j</groupId>
                  <artifactId>log4j</artifactId>
                  <version>1.2.16</version>
                 
              </dependency>
              <dependency>
                  <groupId>com.sun.faces</groupId>
                  <artifactId>jsf-api</artifactId>
                  <version>2.0.4-b02</version>
                 
              </dependency>
              <dependency>
                  <groupId>com.sun.faces</groupId>
                  <artifactId>jsf-impl</artifactId>
                  <version>2.0.4-b02</version>
                 
              </dependency>
              <dependency>
                  <groupId>javax.servlet</groupId>
                  <artifactId>servlet-api</artifactId>
                  <version>2.5</version>
                 
              </dependency>
               <dependency>
                  <groupId>org.richfaces.ui</groupId>
                  <artifactId>richfaces-ui</artifactId>
                  <version>3.3.3.Final</version>

       

                  <exclusions>
                      <exclusion>
                          <artifactId>jsf-api</artifactId>
                          <groupId>javax.faces</groupId>
                      </exclusion>
                      <exclusion>
                          <artifactId>jsf-impl</artifactId>
                          <groupId>javax.faces</groupId>
                      </exclusion>
                  </exclusions>
              </dependency>
              <!--
              <dependency>
                  <groupId>org.richfaces.framework</groupId>
                  <artifactId>richfaces-api</artifactId>
                  <version>3.3.1.GA</version>
                 
              </dependency>
              -->
              <dependency>
                  <groupId>org.richfaces.framework</groupId>
                  <artifactId>richfaces-impl-jsf2</artifactId>
                  <version>3.3.3.Final</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-core</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-web</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-beans</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-context</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-aop</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-context-support</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-tx</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-orm</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-jdbc</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-test</artifactId>
                  <version>${spring.version}</version>
              </dependency>
              <dependency>
                  <groupId>mysql</groupId>
                  <artifactId>mysql-connector-java</artifactId>
                  <version>5.1.13</version>
                 
              </dependency>
              <!--
              <dependency>
                  <groupId>org.springframework.javaconfig</groupId>
                  <artifactId>spring-javaconfig</artifactId>
                  <version>1.0.0.M4</version>
                 
                  <exclusions>
                      <exclusion>
                          <artifactId>spring-beans</artifactId>
                          <groupId>org.springframework</groupId>
                      </exclusion>
                      <exclusion>
                          <artifactId>spring-context</artifactId>
                          <groupId>org.springframework</groupId>
                      </exclusion>
                      <exclusion>
                          <artifactId>spring-core</artifactId>
                          <groupId>org.springframework</groupId>
                      </exclusion>
                  </exclusions>
              </dependency>
              -->
              <dependency>
                  <groupId>spring</groupId>
                  <artifactId>spring-webmvc</artifactId>
                  <version>1.0.2</version>
                 
              </dependency>
              <dependency>
                  <groupId>javax.mail</groupId>
                  <artifactId>mail</artifactId>
                  <version>1.4.1</version>
                 
              </dependency>
              <dependency>
                  <groupId>com.octo.captcha</groupId>
                  <artifactId>jcaptcha</artifactId>
                  <version>1.0</version>
                 
              </dependency>
             
              <dependency>
                  <groupId>com.sun.facelets</groupId>
                  <artifactId>jsf-facelets</artifactId>
                  <version>1.1.14</version>
                 
              </dependency>
             
              <!--
              <dependency>
                  <groupId>xerces</groupId>
                  <artifactId>xerces</artifactId>
                  <version>2.4.0</version>
              </dependency>
              -->
              <dependency>
                  <groupId>xerces</groupId>
                  <artifactId>xercesImpl</artifactId>
                  <version>2.9.1</version>
              </dependency>

       

              <dependency>
                  <groupId>xerces</groupId>
                  <artifactId>xmlParserAPIs</artifactId>
                  <version>2.6.2</version>
              </dependency>
              <dependency>
                  <groupId>commons-collections</groupId>
                  <artifactId>commons-collections</artifactId>
                  <version>3.2.1</version>
                 
              </dependency>
              <dependency>
                  <groupId>javax.annotation</groupId>
                  <artifactId>jsr250-api</artifactId>
                  <version>1.0</version>
                 
              </dependency>
              <dependency>
                  <groupId>org.apache.velocity</groupId>
                  <artifactId>velocity</artifactId>
                  <version>1.6.4</version>
                 
              </dependency>
              <dependency>
                  <groupId>net.sourceforge.jwebunit</groupId>
                  <artifactId>jwebunit-htmlunit-plugin</artifactId>
                  <version>2.4</version>
                  <scope>test</scope>
              </dependency>

       

          </dependencies>
          <build>
              <plugins>
                  <plugin>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>2.0.2</version>
                      <configuration>
                          <source>1.6</source>
                          <target>1.6</target>
                      </configuration>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-war-plugin</artifactId>
                      <configuration>
                          <webResources>
                              <webResource>
                                  <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                                  <includes>
                                      <include>web.xml</include>
                                  </includes>
                                  <targetPath>WEB-INF</targetPath>
                                  <filtering>true</filtering>
                              </webResource>
                          </webResources>
                      </configuration>
                  </plugin>
              </plugins>
              <finalName>ROOT</finalName>
          </build>
          <repositories>
              <repository>
                  <id>unknown-jars-temp-repo</id>
                  <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
                  <url>file:${project.basedir}/lib</url>
              </repository>
          </repositories>
          <properties>
              <spring.version>3.0.4.RELEASE</spring.version>
              <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
          </properties>
      </project>