In this file, we declare the validation of the fields in our forms. Remember that the html tag
"form" and the "form-bean" defined in struts-config.xml are strictly connected.
Let's see an example of form validation:
In the previous code, we have declared a form to validate. The attribute "name" is the name
of a form-bean as declared in struts-config.xml.
Let's add a field to validate:
The value of attribute "property" is the name of the field, as declared in the relative
The value of attribute "depends" is the type of validation to do. In our example a value
is necessary ("required") and cannot be of an arbitrary length ("maxlength").
If a validation error occurs, then the name of the field is obtained from resource "generic", in
particular by value of the key "test_msg".
If the maxlength validation fails, the max number of chars using the
value of tag "var-value" is shown.
To see more clearly what was described above, try to send a blank value or a value bigger than 99 and see