-
1. Re: Client Validation module for Richfaces 4.0 M4 release
ilya_shaikovsky Nov 25, 2010 6:47 AM (in response to monana)1 of 1 people found this helpfulin 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"/>
-
2. Re: Client Validation module for Richfaces 4.0 M4 release
zeppelinux Dec 24, 2010 4:03 PM (in response to ilya_shaikovsky)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 Dec 27, 2010 6:31 AM (in response to zeppelinux)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 Jan 4, 2011 4:03 AM (in response to ilya_shaikovsky)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 Jan 4, 2011 4:38 AM (in response to dgalland)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 Jan 13, 2011 5:51 PM (in response to dgalland)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 Jan 17, 2011 11:59 PM (in response to agurkas)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 Jan 18, 2011 3:40 AM (in response to richfacesfan)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 Jan 18, 2011 11:12 AM (in response to monana)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.