validation.xml 配置样例
validation.xml配置样例如下:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"><validators><field name="userName"><field-validator type="requiredstring"><param name="trim">true</param><message>必须输入名称</message></field-validator><field-validator type="regex"><param name="expression"><![CDATA[(\w{4,25})]]></param><message>用户名只能是数字和字母,且长度必须在4到25之间</message></field-validator></field><field name="password"><field-validator type="requiredstring"><param name="trim">true</param><message>必须输入密码</message></field-validator><field-validator type="regex"><param name="expression"><![CDATA[(\w{4,25})]]></param><message>密码只能是数字和字母,且长度必须在4到25之间</message></field-validator></field><field name="age"><field-validator type="int"><param name="min">1</param><param name="max">150</param><message>年龄必须在1到150之间</message></field-validator></field><field name="birthday"><field-validator type="date"><param name="min">1900-01-01</param><param name="max">2050-12-31</param><message>出生日必须在${min}到${max}之间</message></field-validator></field></validators>
?