<var>
<var-name>max</var-name>
<var-value>100</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
由于validator要从资源文件中读取error messages,所以还要配置资源文件。在com.my包中新建一资源文件,取名为application.properties(扩展名必须为propertyies),其内容如下:
# struts validator error messages
errors.required={0} is required.
errors.minlength={0} can not be less than {1} characters.
errors.maxlength={0} can not be greater than {1} characters.