Thursday, November 26, 2009

primefaces and jsr 303 via extval

the previous post shows how easy it is to set-up extval to be used with primefaces.

in the meantime i created a small example [1] which shows that it is very easy to use jsr 303 constraints in a primefaces application via extval.

furthermore, the demo shows ajax validation based on jpa annotations as well as cross-validation via ajax and the none-blocking warn mode.

moreover, the example shows the optional component support module for primefaces. for example it allows component initialization of the password-component based on meta-data. that's equivalent to the functionally available for the standard components. if a property bound to this special primefaces component hosts meta-data about min and max length (e.g. the jsr 303 constraint @Size(min = 7, max = 14), these information get transferred to the component automatically.

a sample screen of the demo:



[1] http://code.google.com/p/sandbox890/source/browse/#svn/trunk/examples/primefaces_extval/example_01

Monday, November 23, 2009

os890 maven repository

it was a frequent user request that the myfaces-extval add-ons should be available via a maven 2 repository. so i created a repository for os890 as well as for sandbox890.

so you just have to add e.g. the following part to the repositories section of your pom.xml


<repository>
<id>os890.googlecode.com</id>
<url>http://os890-m2-repository.googlecode.com/svn/tags/os890</url>
</repository>


snapshots are available via

<repository>
<id>os890.googlecode.com</id>
<url>http://os890-m2-repository.googlecode.com/svn/trunk/os890</url>
</repository>


further information are available in the usage-wiki as well as the repository overview!

Sunday, November 15, 2009

myfaces extval 2 and icefaces 2

today i had a quick look at the first version of icefaces 2. it looks really nice. so i added extval to the component demo project.

i tested simple constraints as well as cross-validation (cross-component-validation/inter component validation). both worked quite nice also with ajax enabled input components.

also new extval features like severity aware validation (e.g. non-blocking warn mode) work quite well.

i'm looking forward to seeing the final version!

the upgrade of the demo (with extval) was done quite fast:
just adding the jar files and using the constraints!

in this case i used the following maven dependencies for extval:

groupId: org.apache.myfaces.extensions.validator
artifactId: myfaces-extval-core
version: 2.0.3-SNAPSHOT

groupId: org.apache.myfaces.extensions.validator.validation-modules
artifactId: myfaces-extval-property-validation
version: 2.0.3-SNAPSHOT

currently we also need (we will see if we need it with the final version as well)
groupId: org.apache.myfaces.extensions.validator.component-support-modules
artifactId: myfaces-extval-generic-support
version: 2.0.3-SNAPSHOT

for sure also the myfaces extval support for jsr 303 works out-of-the-box after adding the needed jar files...

Friday, November 13, 2009

bean-validation constraint validators and dependency injection support in jsf

myfaces extval allows to use beans as validators. so it's possible to inject services into validators. bean-validation (jsr 303) specifies that the class of a validator has to be defined hardcoded. anyway, via the ConstraintValidatorFactory it's possible to change the default behavior.

in jsf you can query beans by name (not by type which is possible e.g. in spring). extval allows to provide a custom implementation of the ValidatorFactory. so you can optimize the lookup for your dependency management container (e.g. to make it typesafe).

anyway, out of the box the bv-integration module of extval (the next milestone of it) allows to provide/override constraint-validators via bean(s).
a detailed description is available at EXTVAL-70.

a spring bean for the example mentioned in EXTVAL-70 would be:

<bean id="customConstraintValidator">
class="at.gp.demo.CustomConstraintValidator"
scope="prototype">
<property name="customService" ref="...">
</bean>

Thursday, November 12, 2009

bean-validation support for richfaces via extval

today i upgraded an internal richfaces 3.3.x demo to use extval to integrate jsr 303 validation.

the upgrade was done quite fast:
just adding the jar files and using the bv constraints!

in this case i used the following maven dependencies:

for richfaces:
groupId: org.richfaces.ui
artifactId: richfaces-ui
version: 3.3.2.GA

for extval:
groupId: org.apache.myfaces.extensions.validator
artifactId: myfaces-extval-core
version: 1.2.3-SNAPSHOT

required to use a4j with extval:
groupId: org.apache.myfaces.extensions.validator.component-support-modules
artifactId: myfaces-extval-generic-support
version: 1.2.3-SNAPSHOT

to use jsr 303 validation:
groupId: org.apache.myfaces.extensions.validator.validation-modules
artifactId: myfaces-extval-bean-validation
version: 1.2.3-SNAPSHOT

groupId: org.hibernate
artifactId: hibernate-validator
version: 4.0.0.GA

groupId: org.slf4j
artifactId: slf4j-api
version: 1.4.2

groupId:org.slf4j
artifactId: slf4j-log4j12
version: 1.4.2

to support org.richfaces.component.html.HtmlCalendar
groupId: sandbox890.extensions.validator.component-support-modules
artifactId: myfaces-extval-richfaces-support
from http://code.google.com/p/sandbox890/