<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//Apache Struts//XWork Validator 1.0.3//EN"
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
<!-- 校验规则定义的跟元素 -->
<validators>
<!-- 第一个校验field:username -->
<field name="username">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>用户名不能为空!</message>
</field-validator>
</field>
<field name="password1">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>密码不能为空!</message>
</field-validator>
</field>
<field name="password2">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>确认密码不能为空!</message>
</field-validator>
</field>
<field name="birthday">
<field-validator type="date">
<param name="min">1900-01-01</param>
<param name="min">2016-01-01</param>
<message>生日应该在一个范围内</message>
</field-validator>
</field>
</validators>
valiators数据校验
最新推荐文章于 2024-08-14 23:15:50 发布