int 整数;
double 实数;
date 日期;
expression 两数的关系比较;
email Email地址;
url
visitor
conversion
regex 正则表达式验证;
required 是否为空;
requiredstring 必须字符;
stringlength 输入字符长度限制;
答案补充 url web地址 visitor 访问 conversion 转换
<validators>
<field name="user.userName">
<!-- 验证字符串不能为空 -->
<field-validator type="requiredstring">
<!-- 去空格 -->
<param name="trim">true</param>
<!-- 错误提示信息 -->
<message>用户名不能为空</message>
</field-validator> <!-- 验证字符串长度 -->
<field-validator type="stringlength">
<param name="minLength">2</param>
<param name="maxLength">20</param>
<message>用户名长度应在2到18个字符间</message>
</field-validator>
</field> <field name="user.password">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>密码不能为空</message>
</field-validator> <field-validator type="stringlength">
<param name="minLength">6</param>
<param name="maxLength">18</param>
<message>密码长度应在6到18个字符之间</message>
</field-validator>
</field> <field name="user.age">
<field-validator type="int">
<param name="min">1</param>
<param name="max">150</param>
<message>年龄应在1到150之间</message>
</field-validator>
</field>
<!-- 验证字符串为日期类型 -->
<field name="user.birthday">
<field-validator type="date">
<param name="min">1900-01-01</param>
<param name="max">2008-10-16</param>
<message>出生日期应在1900-01-01到2008-10-16</message>
</field-validator>
</field>
</validators>