9 Replies Latest reply on Jan 18, 2011 11:12 AM by dgalland

    Client Validation module for Richfaces 4.0 M4 release

    monana

      Hi,

       

      I need to implement rich:ajaxvalidator in my application with richfaces M4 release.

      I could check in the M4 description saying "Base server side functionality for Client Side Validation is ready! So we already supporing 3.3.x Ajax validation functionality. Last step is concrete client side validators  implementation for introducing complete feature in next Milestone! (Note: validation module not assembled to main build so should be checked out as separate module and built.)"


      So where can i find the validation module for M4 release?

       

      - Monika

        • 1. Re: Client Validation module for Richfaces 4.0 M4 release
          ilya_shaikovsky

          in general it's pretty simple. Having RF 4 sources just build ui/validator module and add to your application pom.xml:

           

              <dependencies>
                  <dependency>
                      <groupId>org.richfaces.ui</groupId>
                      <artifactId>richfaces-components-ui</artifactId>
                  </dependency>
                  <dependency>
                       <groupId>org.richfaces.ui.validator</groupId>
                       <artifactId>richfaces-ui-validator-ui</artifactId>
                       <version>4.0.0-SNAPSHOT</version>
                  </dependency>
                  <dependency>
                       <groupId>org.richfaces.ui.validator</groupId>
                       <artifactId>richfaces-ui-validator-impl</artifactId>
                       <version>4.0.0-SNAPSHOT</version>
                  </dependency>
                  <dependency>
                       <groupId>org.richfaces.ui.validator</groupId>
                       <artifactId>richfaces-ui-validator-api</artifactId>
                       <version>4.0.0-SNAPSHOT</version>
                  </dependency>
                  <dependency>
                       <groupId>javax.validation</groupId>
                       <artifactId>validation-api</artifactId>
                       <version>1.0.0.GA</version>
                  </dependency>
              <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>4.0.2.GA</version>
              </dependency>

          <dependency>

            <groupId>org.slf4j</groupId>

            <artifactId>slf4j-log4j12</artifactId>

            <version>1.4.2</version>

          </dependency>

                  <dependency>

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

                       <artifactId>richfaces-ui-validator-ui</artifactId>

                       <version>4.0.0-SNAPSHOT</version>

                  </dependency>

                  <dependency>

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

                       <artifactId>richfaces-ui-validator-impl</artifactId>

                       <version>4.0.0-SNAPSHOT</version>

                  </dependency>

                  <dependency>

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

                       <artifactId>richfaces-ui-validator-api</artifactId>

                       <version>4.0.0-SNAPSHOT</version>

                  </dependency>

                  <dependency>

                       <groupId>javax.validation</groupId>

                       <artifactId>validation-api</artifactId>

                       <version>1.0.0.GA</version>

                  </dependency>

              <dependency>

                <groupId>org.hibernate</groupId>

                <artifactId>hibernate-validator</artifactId>

                <version>4.0.2.GA</version>

              </dependency>

           

          Then add to the page like:

           

           

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

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

                xmlns:v="http://richfaces.org/csv">

           

          <body>

          <ui:composition template="/templates/template.xhtml">

           

              <ui:define name="title">RichFaces Sample</ui:define>

           

              <ui:define name="body">

                  <h:form>

                      <h:outputLabel value="Name:" for="nameInput" />

                      <h:inputText id="nameInput" value="#{richBean.name}">

                          <v:validator render="out"/>

           

                      </h:inputText>

                      <h:panelGroup id="output">

                          <h:outputText value="Hello #{richBean.name}!"

                              rendered="#{not empty richBean.name}" />

                      </h:panelGroup>

                       <a4j:commandButton></a4j:commandButton>

                  </h:form>

                  <a4j:outputPanel ajaxRendered="true" id="out">

                       <h:messages />

                  </a4j:outputPanel>

              </ui:define>

          </ui:composition>

          </body>

          </html>

           

          Current issues:

          https://jira.jboss.org/browse/RF-9864

          https://jira.jboss.org/browse/RF-9863

           

          considering issues especially 9863 - probably better to try after fix. But if you wish to start adding right now - could workaround that issue also.

           

          If will decide not to try for now - ajax validation could be performed using just

           

          <a4j:ajax bypassUpdates="true"/>

          1 of 1 people found this helpful
          • 2. Re: Client Validation module for Richfaces 4.0 M4 release
            zeppelinux

            Hi Ilya,

             

            after checking out the 4.0.0.20101220-M5  from svn I can deploy the csv demo and see it working (looks good!), but  when i try to add richfaces-ui-validator-api-4.0.0.20101220-M5.jar and  richfaces-ui-validator-ui-4.0.0.20101220-M5.jar to my project that uses  components and core jars compiled from the same tag source it fails on  deployment (JBoss 5.0.1) with the following error:

             

            Caused by: java.lang.IllegalArgumentException: duplicate key: class javax.faces.validator.LengthValidator
                     at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:62)
                     at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:211)
                     at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:197)
                     at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:50)
                     at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:73)
                     at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:67)
                     at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:28)
                     at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:136)
                     at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:110)
                     at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:152)
                     at javax.faces.event.SystemEvent.processListener(SystemEvent.java:102)
                     at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2040)
                     at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2016)
                     at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:298)
                     at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:598)
                     at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:341)

            • 3. Re: Client Validation module for Richfaces 4.0 M4 release
              ilya_shaikovsky

              separate module was actual only for M4. in M5 it assembled into main build. B.t.w. we had some respins so make sure you using latest tag. Or just use snapshots.

              • 4. Re: Client Validation module for Richfaces 4.0 M4 release
                dgalland

                Hello,

                I try the 4.0.0.20101220-M5

                Without the validation-api.jar -> Class not found

                With the validation-api.jar I have also:

                duplicate key: class javax.faces.validator.LengthValidator

                 

                I have also another question:

                What happens with the rich:columns component ?

                Can the a4j:repeat repeat rich:column component (the ui:repeat doesnt) ?

                I think that its a very imortant component as you dont have another means to build dynamic columns.

                 

                Thanks for your work and best regards.

                • 5. Re: Client Validation module for Richfaces 4.0 M4 release
                  ilya40umov

                  see  http://community.jboss.org/thread/160380?tstart=50 about rich:columns, I guess c:forEach should help you

                  • 6. Client Validation module for Richfaces 4.0 M4 release
                    agurkas

                    I've had the same duplicate key error when accidentaly added source jar files. Make sure you have just binary jars in your classpath.

                     

                    >With the validation-api.jar I have also:

                    >duplicate key: class javax.faces.validator.LengthValidator

                    • 7. Client Validation module for Richfaces 4.0 M4 release
                      richfacesfan

                      i have the same error,

                      i don't work with maven and please need any solution ,

                      i thanks for ever with yours

                      regards!!

                       

                      • 8. Client Validation module for Richfaces 4.0 M4 release
                        ilya_shaikovsky

                        http://community.jboss.org/message/581450#581450 - my comment there. If your server provides validation implementation but it just not works please provide info about aplication server.

                        • 9. Client Validation module for Richfaces 4.0 M4 release
                          dgalland

                          I work with Tomcat 6.0.29 ie without validation

                           

                          I retry with the released M5

                          - without api and impl validation it works

                          - with api and without impl -> Exception unable to find a default provider

                          - with api and impl (hibernate-validator)  it works

                          So all its correct !

                           

                          For the "duplicate key"  as stated above error users have to be careful and dont put richfaces sources jar in the WEB-INF/lib directory, it was also my mistake !

                          Thanks for your work.