JSF Client Side Validators RELOADED
April 26, 2006 13 Comments
They’ve existed once, donated to myFaces and suddenly disappeared… Now JSF Client Side Validators are back to the city🙂 Well here’s what really happened. Actually me and Martin decided that it would be better provide similar client side validation support for the extended validators in tomahawk. So instead of using seperate client side validators, the ones already in the tomahawk will have enableClientScript flag which will enable them to validate at client side. I’m currently working on it; on my way since these seperate client validators once created have not been released so far, I’ve decided to release them at jsf-comp. Before doing the release I’ve added many features to the client validation library. Here are the currently supported validators.
1) Required Field Validator
2) Range Validator
3) Compare Validator
4) Regular Expression Validator
5) Length Validator
6) Integer Only Validator
7) Custom Validator
8) Validation Summary
And two views showing the client validation framework in action, one without popup and one with.
1) Client Validation in JSF is also supported by Shale and ADF Faces however both use unattractive popups to display the validation messages. By default client Validators show the validation message where they are placed. However this is not mandatory, popups are also supported with an optional boolean attribute.
2) Client validators are extendable via the Custom Validator component, you can plug your own validator functions to this component.
3) Error messages are fully customizable, each validator can user their own message or read from a bundle.
4) Style of the validation messages can be managed through the style attribute.
5) Resource loading is done from the jar file so there is no need to use additional resources like js files, only thing you need is the jar file.
6) Validation Summary component allows the presentation of each validation message in one place.
7) Display mode is customizable which means space for messages can be reserved or created dynamically, also if set to none then the message is only displayed at validation summary.
8) Highlighting is supported, if set true then the components caused the validation is highlighted with color.
9) Implementation independency, client validators can be plugged to any JSF implementation.
The project is no longer under development but the successor of this library has joined Apache MyFaces.
Detailed Documentation and Download
* There is a very detailed documentation at jsf-comp.
* Both source and the distribution can be reached at jsf-comp downloads section.
* I’ve provided an example web application which can also be reached at downloads section.
* In addition I’ve updated my first entry on the client validators.