数据库在生活中的实例 Struts从零开始五、Struts中验证数据实例[6]
Struts从零开始五、Struts中验证数据实例[6]
添加验证规则
在WEB INF下创建validaton xml这个文件 导入引用的dtd 添加如下内容
修改Resource Boundle文件
英文的资源文件 applicationResource_en_US properties
errors required={ } is required
errors minlength={ } can not be less than { } characters
errors maxlength={ } can not be greater than { } characters
errors invalid={ } is invalid
errors byte={ } must be a byte
errors short={ } must be a short
errors integer={ } must be an integer
errors long={ } must be a long
errors float={ } must be a float
errors double={ } must be a double
errors date={ } is not a date
errors range={ } is not in the range { } through { }
errors creditcard={ } is an invalid credit card number
errors email={ } is an invalid e mail address
button submit=Submit
button reset=Reset
button cancel=Cancel
label username=UserName:
![数据库在生活中的实例 Struts从零开始五、Struts中验证数据实例[6]](http://img.zhputi.com/uploads/2fb9/2fb9a4ec85dca993ae3da92ee87cf8a28144.jpg)
label password=Password:
loginform error username=please enter your username
loginform error password=please enter your password
loginform fail=invalidation name and password login error!
中文的资源文件 applicationResource_zh_CN properties
errors required={ } 是必须的
errors minlength={ } 不能少于 { } 个字符
errors maxlength={ } 不能多于 { } 个字符
errors invalid={ } 是非法的
lishixinzhi/Article/program/Java/ky/201311/29086