Using rich:ajaxValidator

One of the new components in RichFaces 3.2.2 is rich:ajaxValidator. One of the major features is that the validator works against Hibernate Validator. In other words, you mark a bean with Hibernate Validations annotations, and then use this tag. Very similar to Seam. It’s also possible to use this tag without Hibernate Validator annotations, we can use plain old JSF validation as well. For example:


We don’t need to use a4j:support anymore, we get this functionality automatically from rich:ajaxValidator. Because we are using onblur event, request (and validation) will be done when you tab out of the input field or click somewhere on the page. What’s important, when using this component, we will go up to Process Validation phase and then go to Render Response. This obviously useful when validating a form. Another thing, ajaxSingle is set to true by default. This means only this component will be processed on the server.

The above example is virtually identical to this:


Of course one major difference is that rich:ajaxValidator also works with Hibernate validation.

If you want to learn all the important concepts and features in RichFaces quickly, I started a new 1-day RichFaces training. This is type of training is a lot more beneficial then learning and “prototyping” on your own for 3-4 weeks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.