Struts String Length Field Validator XML
<field name="fieldName">
<field-validator type="stringlength">
<param name="param name">param value</param>
<message>validation error message</message>
</field-validator>
</field>
Struts 2 String Length Validation
The string length field validator makes sure that a string fieldâs length, such as a passwordâs 6â12 characters, stays within a certain range. Using the stringlength property in elements or annotation types may be applied to XML or annotations. The String will have at least that many characters if the minLength option is supplied. When the maxLength argument is used, the String will only have that many characters at maximum. It decides whether to trim the String before doing the length check based on the trim option. The String will be truncated if it is not supplied.
Contact Us