The Commons Validator is a basic validation framework that lets you define validation rules for a JavaBean in an xml file. Validators, the validation definition, can also be defined in the xml file. An example of a validator would be defining what method and class will be called to perform the validation for a required field. Validation rules can be grouped together based on locale and a JavaBean/Form that the rules are associated with. The framework has basic support for user defined constants which can be used in some field attributes.
Here is the quick tutorial for Jakarta common validator, you can see that there is a need to define a validation rule xml file to declare the validation rules and objects & fields to be validated.
Noted, inside the xml file, the individual fields in the input data are called fields, the set of input data is collectively called a form, and a collection of forms is called a form-set.
The relationship between the elements is shown here:
Fields --> Forms --> FormSet
Struts Validator is built on Jakarta Commons validator and other common packages. It split the rule defintion xml file into two, one (validation-rules.xml) is for rule definitions, another (validation.xml) is for which and what object and fields to be validated. Struts validator is a web form validator and support both client and server side validation.
Here is a tutorial for how to use the Struts Validator.
Highscalability is Up For Sale
11 months ago
No comments:
Post a Comment