The client-side validation in Struts is well known. Here are some of the available features:
* required
* requiredif
* validwhen
* minlength
* maxlength
* mask
* byte
* short
* integer
* long
* float
* double
* byteLocale
* shortLocale
* integerLocale
* longLocale
* floatLocale
* doubleLocale
* date
* intRange
* longRange
* floatRange
* doubleRange
* creditCard
* url
These are found in the validator-rules.xml inside the
Let us know create a new validator for entering the name field of a form. The form should accept only "administrator" for the name field. To accomplish this edit the validator-rules.xml and add the following code under the
jcv_handleErrors(fields, focusField);
}
return isValid;
}
]]>