10 Replies Latest reply on Apr 6, 2011 4:02 AM by maxim_rong

    rich faces 4 does not work

    maxim_rong

      i have user rich faces 4 to my project, but i find it does not work. and i don't know why?

       

      my project user jsf2 + mybatis + weblogic

      IDE is myEclipse8.5

       

      i import jar is:

      richfaces-components-ui-4.0.0 FInal.jar

      richfaces-components-api-4.0.0 FInal.jar

      richfaces-core-impl-4.0.0 FInal.jar

      richfaces-core-api-4.0.0.Final.jar

      sac-1.3.jar

      cssparser-0.9.5.jar

      guava-r08.jar

       

      The following is my page:

      {code:xml}

      <?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:a4j="http://richfaces.org/a4j"

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

            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:t="http://myfaces.apache.org/tomahawk">

          <head>

              <title>MyTest.xhtml</title>

              <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

              <script src="js/jquery-1.5.1.min.js"></script>

              <script>

              <!--

       

              window.onload = function() {

       

                //  test();

              }

       

       

              //-->

              </script>

          </head>

       

          <h:body>

            <h:form>

       

              <table align="center">

                  <tr>

                      <td>用户名:</td>

                      <td><t:inputText forceId="true" id="emailPre" value="#{userInfo.emailPre}" >

                          <a4j:ajax event="keyup" render="outtext"  />

                      </t:inputText> @

                      <t:selectOneMenu id="menu1" value="#{userInfo.emailSuf}">

                          <t:selectItems value="#{userInfo.emailSufList}" var="suf" itemLabel="#{suf}" itemValue="#{suf}" />

                      </t:selectOneMenu>

                      <h:outputText id="outtext" value="#{userInfo.emailPre}" />

                      </td>

                  </tr>

                  <tr>

                      <td>密码: </td>

                      <td><t:inputText forceId="true" value="#{userInfo.passWord}"/> </td>

                  </tr>

                  <tr>

                      <td></td>

                      <td></td>

                  </tr>

              </table>

            </h:form>

          </h:body>

      </html>

      {code}

       

      i hava change "emailPre"(id), but the outputText id="outtext" show nothing!

       

      The following is my web.xml:

      {code: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">

       

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

       

          <servlet-mapping>

              <servlet-name>Faces Servlet</servlet-name>

              <url-pattern>*.jsf</url-pattern>

          </servlet-mapping>

       

          <context-param>

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

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

          </context-param>

       

          <welcome-file-list>

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

          </welcome-file-list>

       

      </web-app>

      {code}

       

      face-config.xml

      {code:xml}

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

      <faces-config 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-facesconfig_2_0.xsd"

          version="2.0">

       

          <managed-bean>

              <managed-bean-name>javaTest</managed-bean-name>

              <managed-bean-class>agile.web.test.JavaTest</managed-bean-class>

              <managed-bean-scope>request</managed-bean-scope>

          </managed-bean>

       

          <managed-bean>

              <managed-bean-name>userInfo</managed-bean-name>

              <managed-bean-class>com.agile.sys.UserInfo</managed-bean-class>

              <managed-bean-scope>session</managed-bean-scope>

          </managed-bean>

       

      </faces-config>

      {code}

        • 1. rich faces 4 does not work
          iabughosh

          Hi Maxim,

          Welcome to the forum , see this thread : http://community.jboss.org/thread/164874

          • 2. rich faces 4 does not work
            maxim_rong

            hi,ibrahim, thank you for your help!

            i have see the thread,i find when i run the project, it appear the follow warning:

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class javax.validation.constraints.NotNull, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class org.hibernate.validator.constraints.NotEmpty, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class javax.validation.constraints.Size, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class javax.validation.constraints.Pattern, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class javax.validation.constraints.Min, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class javax.validation.constraints.Max, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class javax.validation.constraints.AssertTrue, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.javascript.ClientServiceConfigParser parse

            警告: Found JavaScript function definition for class javax.validation.constraints.AssertFalse, but that class is not presented

            2011-4-5 16:55:48 org.richfaces.cache.CacheManager getCacheFactory

            信息: Selected fallback cache factory

            2011-4-5 16:55:48 org.richfaces.cache.lru.LRUMapCacheFactory createCache

            信息: Creating LRUMap cache instance using parameters: {javax.faces.DEFAULT_SUFFIX=.xhtml, com.sun.faces.injectionProvider=com.bea.faces.WeblogicInjectionProvider}

            2011-4-5 16:55:48 org.richfaces.cache.lru.LRUMapCacheFactory createCache

            信息: Creating LRUMap cache instance of 512 items capacity

            2011-4-5 16:55:48 org.richfaces.application.InitializationListener onStart

            信息: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0.Final SVN r.22269

             

            警告 is warning, it is chinese and 信息 is message  ^ _ ^

             

            i do not found the class NotNull, it is which package?

             

            it is my pom:

            {code: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.agile</groupId>

                <artifactId>RealAgileWeb</artifactId>

                <version>0.0.1</version>

                <packaging>war</packaging>

                <name />

                <description />

                <dependencies>

             

                    <dependency>

                        <groupId>log4j</groupId>

                        <artifactId>log4j</artifactId>

                        <version>1.2.16</version>

                    </dependency>

             

                    <dependency>

                        <groupId>com.sun.faces</groupId>

                        <artifactId>jsf-impl</artifactId>

                        <version>2.1.0</version>

                    </dependency>

             

                    <dependency>

                        <groupId>com.sun.faces</groupId>

                        <artifactId>jsf-api</artifactId>

                        <version>2.1.0</version>

                    </dependency>

             

                    <dependency>

                        <groupId>org.apache.myfaces.tomahawk</groupId>

                        <artifactId>tomahawk</artifactId>

                        <version>1.1.10</version>

                    </dependency>

             

                    <dependency>

                        <groupId>jstl</groupId>

                        <artifactId>jstl</artifactId>

                        <version>1.1.2</version>

                    </dependency>

             

                    <dependency>

                        <groupId>taglibs</groupId>

                        <artifactId>standard</artifactId>

                        <version>1.1.2</version>

                    </dependency>

             

                    <dependency>

                        <groupId>commons-beanutils</groupId>

                        <artifactId>commons-beanutils</artifactId>

                        <version>1.8.3</version>

                    </dependency>

             

                    <dependency>

                        <groupId>commons-collections</groupId>

                        <artifactId>commons-collections</artifactId>

                        <version>3.2.1</version>

                    </dependency>

             

                    <dependency>

                        <groupId>commons-digester</groupId>

                        <artifactId>commons-digester</artifactId>

                        <version>2.1</version>

                    </dependency>

                    <dependency>

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

                        <artifactId>richfaces-core-api</artifactId>

                        <version>4.0.0.Final</version>

                    </dependency>

                    <dependency>

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

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

                        <version>4.0.0.Final</version>

                    </dependency>

                    <dependency>

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

                        <artifactId>annotations</artifactId>

                        <version>4.0.0.Final</version>

                    </dependency>

                    <dependency>

                        <groupId>javax.annotation</groupId>

                        <artifactId>jsr250-api</artifactId>

                        <version>1.0</version>

                    </dependency>

                    <dependency>

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

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

                        <version>4.0.0.Final</version>

                    </dependency>

                    <dependency>

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

                        <artifactId>richfaces-components-api</artifactId>

                        <version>4.0.0.Final</version>

                    </dependency>

                    <!--

                        <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml-schemas</artifactId>

                        <version>3.6</version> </dependency>

                    -->

                    <!--

                        <dependency> <groupId>org.richfaces.framework</groupId> <artifactId>richfaces-api</artifactId>

                        <version>3.3.3.Final</version> </dependency> <dependency> <groupId>org.richfaces.framework</groupId>

                        <artifactId>richfaces-impl</artifactId> <version>3.3.3.Final</version> </dependency> <dependency>

                        <groupId>org.richfaces.ui</groupId> <artifactId>richfaces-ui</artifactId> <version>3.3.3.Final</version>

                        </dependency>

                    -->

                </dependencies>

             

                <build>

                    <plugins>

                        <plugin>

                            <groupId>org.apache.maven.plugins</groupId>

                            <artifactId>maven-ear-plugin</artifactId>

                            <version>2.4.2</version>

                            <configuration>

                                <defaultLibBundleDir>lib</defaultLibBundleDir>

                            </configuration>

                        </plugin>

                    </plugins>

                </build>

            </project>

            {code}

            • 3. rich faces 4 does not work
              iabughosh

              it is existed in validation jars, i use Hibernate validation jars bundled with JBoss 6 AS :

              1-hibernate-validator.jar

              2-hibernate-validator-legacy.jar

              1 of 1 people found this helpful
              • 4. Re: rich faces 4 does not work
                maxim_rong

                thanks!

                the warning is disappear!

                but the richface is still Not effective

                is there some error in my Program?

                • 5. rich faces 4 does not work
                  iabughosh

                  what do you mean by not effective ??,

                  please post your web.xml file.

                  • 6. Re: rich faces 4 does not work
                    maxim_rong

                    this is my web.xml

                    {code: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">

                     

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

                     

                        <servlet-mapping>

                            <servlet-name>Faces Servlet</servlet-name>

                            <url-pattern>*.jsf</url-pattern>

                        </servlet-mapping>

                     

                        <context-param>

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

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

                        </context-param>

                     

                        <welcome-file-list>

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

                        </welcome-file-list>

                     

                    </web-app>

                    {code}

                     

                     

                    the index.xhtml is my page

                    you can find

                    {code:xml}<a4j:ajax event="keyup" render="outtext"  />{code}

                    when enter some word in "emailPre"(id), there is nothins show in "outtext“(id).

                    and i user <a4j:jsFunction id="xxx" />, when i invoke xxx(jsFunction), there is a js error(miss object)

                    • 7. Re: rich faces 4 does not work
                      iabughosh

                      i've tried your xhtml file and it is working fine, any way i shared a RichFaces 4 project on 4Shared, here is the link:

                      http://www.4shared.com/file/car78x42/Rich4.html

                       

                      you can download it and see what is the wrong with your project.

                      regards.

                      1 of 1 people found this helpful
                      • 8. Re: rich faces 4 does not work
                        maxim_rong

                        i've download your project,and run it.

                        because there some libraries i miss, so i have make some change.

                        it can run, but it still can't use richfaces tags.(i've see the page in ie and firefox, both of them can't see the effect of the richfaces tags )

                        and i don't know why

                         

                        i have upload the project to 4Shared, here is the link:

                        http://www.4shared.com/account/file/qSsCZdG0/Rich4.html

                         

                        all jars i used put into the project,

                        and i run it on jdk1.6_05.

                         

                        if you can run fine, i think there must be some problem with my develop environment.

                        • 9. Re: rich faces 4 does not work
                          ilya_shaikovsky

                          I just runned the attached project and default index.jsf works for me just fine. Toggle panel switches without problem.

                           

                           

                          But yup, your index.xhtml in pages(with a4j:ahax) didn't work. And the reason clearly shown at server console:

                           

                          sourceId=null[severity=(ERROR 2), summary=(One or more resources have the target of 'head', but no 'head' component has been defined within the view.), detail=(One or more resources have the target of 'head', but no 'head' component has been defined within the view.)]

                           

                          So replace head and body HTML elements to corresponding JSF 2 tags and resources will load properly (checked.)

                          • 10. Re: rich faces 4 does not work
                            maxim_rong

                            it's OK now!!!

                            thank both of you!!!!!

                             

                            i find it is some error with my IDE!

                            in my original workspace(my Company use), it use richfaces tag with html elements is no problem(it use jsf1.2 and richfaces 3.3.3)

                            so i think richfaces4 is also ok.

                             

                            i don't use <h:head> and <h:body> is another reason, because the IDE tell me unknow elements!!!and it show an error!!!

                            i find it don't know the jsf2 and richface4 tags....(myeclipse 8.5)

                            i enter '<h:' then the IDE don't prompt jsf and rich new tags!!

                             

                            thank you very much, it's run fine!!

                            elements