12 Replies Latest reply on Aug 15, 2012 4:31 AM by healeyb

    Cannot get skin to work in version 4.2.2 Final

    kjav

      Hi all, Im new to RichFaces. For my application, I cant apply the skin to my datatable component. I know there are existing thread regarding this https://community.jboss.org/thread/161480  I followed all the configurations but the skin still wont applied. See image below.

       

      usertable.jpg

      I tried the 4.0.0.20101226-M5 version as mention in the thread but it still wont work. Here's my current code:

       

      My pom.xml

       

      <properties>

            <org.richfaces.bom.version>4.2.2.Final</org.richfaces.bom.version>

            <webflow-version>2.3.1.RELEASE</webflow-version>

           <mojarra-version>2.1.7</mojarra-version>

      </properties>

       

       

      <!-- RichFaces -->

       

          <dependency>

                  <groupId>org.richfaces.cdk</groupId>

                  <artifactId>annotations</artifactId>

                  <scope>provided</scope>

                  <version>${org.richfaces.bom.version}</version>         

          </dependency>

         
           <dependency>

                 <groupId>org.richfaces.ui</groupId>

                 <artifactId>richfaces-components-ui</artifactId>

           </dependency>

       

           <dependency>

                <groupId>org.richfaces.core</groupId>

                <artifactId>richfaces-core-impl</artifactId>

           </dependency>

       

      My web.xml

       

        <!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->

        <context-param>

                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

                <param-value>.xhtml</param-value>

        </context-param>

        <!-- Enables special Facelets debug output during development -->

        <context-param>

          <param-name>javax.faces.PROJECT_STAGE</param-name>

          <param-value>Development</param-value>

        </context-param>

       

        <!-- Causes Facelets to refresh templates during development -->

        <context-param>

                  <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>

                  <param-value>1</param-value>

        </context-param>

       

        <!-- Plugging the "Blue Sky" skin into the project -->

        <context-param>

                  <param-name>org.richfaces.SKIN</param-name>

                  <param-value>blueSky</param-value>

        </context-param>

       

        <context-param>

                  <param-name>org.richfaces.enableControlSkinning</param-name>

                  <param-value>true</param-value>

        </context-param>

       

        <context-param>

          <param-name>org.richfaces.enableControlSkinningClasses</param-name>

          <param-value>false</param-value>

        </context-param>

       

        <listener>

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

        </listener>

        <servlet>

          <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

          <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

          <init-param>

            <param-name>contextConfigLocation</param-name>

            <!-- change servlet-context.xml to web-application-config.xml -->

            <param-value><!-- /WEB-INF/spring/web-application-config.xml --></param-value>

          </init-param>

          <load-on-startup>2</load-on-startup>

        </servlet>

       

        <servlet-mapping>

          <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

          <url-pattern>/spring/*</url-pattern>

        </servlet-mapping>

       

      <!-- Just here so the JSF implementation can initialize, *not* used at runtime -->

      <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>*.faces</url-pattern>

      </servlet-mapping>

       

      <welcome-file-list>

                 <welcome-file>index.html</welcome-file>

      </welcome-file-list>

       

      My 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">

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

            xmlns:ui="http://java.sun.com/jsf/facelets"

            xmlns:h="http://java.sun.com/jsf/html"

            xmlns:f="http://java.sun.com/jsf/core"

                   xmlns:rich="http://richfaces.org/rich"

                   xmlns:a4j="http://richfaces.org/a4j">

       

         <h:head>

                   <title>Data Tables</title>

         </h:head> 

       

          <h:body>

                    <h3>JSF STARTED!</h3>

       

                    <rich:panel>

       

                                       <rich:dataTable value="#{userBean.users}" var="user" rows="5" >

                                        <rich:column>

                                            <f:facet name="header">User</f:facet>

                                                   <h:outputText id="name" value="#{user.name}"/>

                                        </rich:column>

                                        <rich:column>

                                                  <f:facet name="header">Email</f:facet>

                                                   <h:outputText id="email" value="#{user.email}"/>

                                        </rich:column>

                                       </rich:dataTable>

       

                            </rich:panel>

       

          </h:body>

      </ui:composition>

       

       

      Sorry for the wall of text but any advise given will be appreciated!

        • 1. Re: Cannot get skin to work in version 4.2.2 Final
          iabughosh

          hello Jav,

          try org.richfaces.skin instead of SKIN.

           

          regards.

          • 2. Re: Cannot get skin to work in version 4.2.2 Final
            kjav

            Hi ibrahim

             

                         Thx for ur reply, yup I did tried using org.richfaces.skin but the displaying of the table still the same... not only the skin is not displaying... the table is not showing also.. but the data is displayed... could it be my xhtml code problem?

            • 3. Re: Cannot get skin to work in version 4.2.2 Final
              healeyb

              This looks like a resource loading problem, the xhmtl looks ok.

               

              I wonder if the fact that you're using suffix mapping on Faces Servlet (*.faces) could have something to do with it. I seem to find

              that an extra .faces gets appended to all my resources (i.e. jsf.js.faces!), although not everyone seems afflicted by this problem,

              but many are.

               

              The best thing is to reload the page with the developer tools of a decent browser and see exactly what's happening. In chrome

              for example you would hit F12, select the network tab, reload the page and look for anything highlighted in red on the left hand

              side.

               

              By comparing the URLs of resources that are loading correctly with those that aren't it should be extremely straightforward to

              diagnose the reason for the problem (famous last words).

               

              Regards,

              Brendan.

               

              p.s. can you just check that it's the same with <html> tags replacing <ui:composition> and perhaps just put an h:form around

                     the panel? probably nothing but...

              • 4. Re: Cannot get skin to work in version 4.2.2 Final
                kjav

                Hi Brendan

                 

                               Thx for the reply, your suggestion help me pinpoint the errors
                error.png

                Its status is 404 not found, trying to figure out how to solve this issue.

                • 5. Re: Cannot get skin to work in version 4.2.2 Final
                  healeyb

                  Hi, can you post the first few lines of your web.xml, I want to know what version of the servlet spec your web container

                  supports...

                  • 6. Re: Cannot get skin to work in version 4.2.2 Final
                    kjav

                    My first few line from web.xml

                     

                    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                   xmlns="http://java.sun.com/xml/ns/javaee"

                                   xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee             

                                   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">

                     

                    Im still trying to figure out what causes this
                    error2.png

                    Could it be some missing jar file?

                    • 7. Re: Cannot get skin to work in version 4.2.2 Final
                      healeyb

                      In a pre v3 container the richfaces resources servlet doesn't auto-register, so you need to add this to your web.xml:

                       

                      <servlet>

                              <servlet-name>Resource Servlet</servlet-name>

                              <servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>

                              <load-on-startup>1</load-on-startup>

                      </servlet>

                      <servlet-mapping>

                              <servlet-name>Resource Servlet</servlet-name>

                              <url-pattern>/org.richfaces.resources/*</url-pattern>

                      </servlet-mapping>

                       

                      then, with a bit of luck you should be in business.

                       

                      Regards,

                      Brendan.

                      • 8. Re: Cannot get skin to work in version 4.2.2 Final
                        kjav

                        Hi Brendan, here's my current xml, I added the code u mention above but still no luck. Strange... still giving me the save error when I hit F12 in chrome.

                         

                        <?xml version="1.0" encoding="UTF-8"?>

                        <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">

                         

                          <context-param>

                            <param-name>contextConfigLocation</param-name>

                            <param-value>

                                    /WEB-INF/spring/web-application-config.xml

                                    /WEB-INF/spring/webmvc-config.xml

                                   /WEB-INF/spring/root-context.xml

                                   /WEB-INF/spring/security-context.xml

                                   classpath:persistence-context.xml

                           </param-value>

                          </context-param>

                         

                          <!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->

                          <context-param>

                                  <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

                                  <param-value>.xhtml</param-value>

                          </context-param>

                         

                          <!-- Enables special Facelets debug output during development -->

                          <context-param>

                            <param-name>javax.faces.PROJECT_STAGE</param-name>

                            <param-value>Development</param-value>

                          </context-param>

                         

                          <!-- Causes Facelets to refresh templates during development -->

                          <context-param>

                                    <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>

                                    <param-value>1</param-value>

                          </context-param>

                         

                          <!-- Plugging the "Blue Sky" skin into the project -->

                          <context-param>

                                    <param-name>org.richfaces.skin</param-name>

                                    <param-value>blueSky</param-value>

                          </context-param>

                         

                          <context-param>

                                    <param-name>org.richfaces.enableControlSkinning</param-name>

                                    <param-value>true</param-value>

                          </context-param>

                         

                          <context-param>

                            <param-name>org.richfaces.enableControlSkinningClasses</param-name>

                            <param-value>false</param-value>

                          </context-param>

                           

                          <context-param>

                            <!--<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> -->

                            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

                            <param-value>client</param-value>

                          </context-param>

                         

                          <context-param>

                            <description>Tag libraries for facelets</description>

                            <param-name>javax.faces.FACELETS_LIBRARIES</param-name>

                            <param-value>/tags/iii.taglib.xml</param-value>

                          </context-param>

                          

                          <servlet>

                            <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

                            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

                            <init-param>

                              <param-name>contextConfigLocation</param-name>

                              <!-- change servlet-context.xml to web-application-config.xml -->

                              <param-value></param-value>

                            </init-param>

                            <load-on-startup>2</load-on-startup>

                          </servlet>

                         

                          <servlet-mapping>

                            <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

                            <url-pattern>/spring/*</url-pattern>

                          </servlet-mapping>

                         

                        <!-- Just here so the JSF implementation can initialize, *not* used at runtime -->

                        <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>Resource Servlet</servlet-name>

                                <servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>

                                <load-on-startup>1</load-on-startup>

                        </servlet>

                         

                        <servlet-mapping>

                                <servlet-name>Resource Servlet</servlet-name>

                                <url-pattern>/org.richfaces.resources/*</url-pattern>

                        </servlet-mapping>

                           

                        <!-- Just here so the JSF implementation can initialize -->

                        <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>

                         

                        <mime-mapping>

                            <extension>ecss</extension>

                            <mime-type>text/css</mime-type>

                        </mime-mapping>

                         

                        <listener>

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

                        </listener>

                         

                        <listener>

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

                        </listener>

                         

                        <context-param>

                            <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>

                            <param-value>resources.application</param-value>

                        </context-param>

                         

                        <listener>

                            <listener-class>com.sun.faces.config.ConfigureListener</listener-class>

                        </listener>

                           

                        <welcome-file-list>

                                   <welcome-file>index.html</welcome-file>

                        </welcome-file-list>

                         

                        </web-app>

                        • 9. Re: Cannot get skin to work in version 4.2.2 Final
                          healeyb

                          Can you do a clean and build, restart the server, redeploy and post the chrome network tab output again? I think the

                          problem is that the richfaces resources requests are getting diverted to the spring dispatcher servlet. What app server

                          are you using?

                           

                          Regards,

                          Brendan.

                          • 10. Re: Cannot get skin to work in version 4.2.2 Final
                            healeyb

                            I've barely ever used spring so I'm right out of my comfort zone but take a look at this where they discuss using an extra bean

                            in order to use spring web flow (I don't even know if you're using "web flow"):

                             

                            https://issues.jboss.org/browse/RFPL-1430

                             

                             

                            Regards,

                            Brendan.

                            • 11. Re: Cannot get skin to work in version 4.2.2 Final
                              kjav

                              hey Brendan, thx for your reply again, u r right! integrating RichFaces 4 with webflow requires the extra bean code, now its working!

                              • 12. Re: Cannot get skin to work in version 4.2.2 Final
                                healeyb

                                Good news that you got it all sorted out. Just a suggestion, would you have the time to do a quick write-up of how you configured

                                this so that it could be posted in the "Articles" section of this site (see above)? The information is available but seems to need a

                                lot of digging to get to it, it would certainly be a help to others if there was more prominent and easily found source available.

                                 

                                Regards,

                                Brendan.