java

位置:IT落伍者 >> java >> 浏览文章

Struts从零开始五、Struts中验证数据实例[6]


发布日期:2020年04月27日
 
Struts从零开始五、Struts中验证数据实例[6]

添加验证规则

在WEBINF下创建validatonxml这个文件导入引用的dtd添加如下内容

修改Resource Boundle文件

英文的资源文件applicationResource_en_USproperties

errorsrequired={} is required

errorsminlength={} can not be less than {} characters

errorsmaxlength={} can not be greater than {} characters

errorsinvalid={} is invalid

errorsbyte={} must be a byte

errorsshort={} must be a short

errorsinteger={} must be an integer

errorslong={} must be a long

errorsfloat={} must be a float

errorsdouble={} must be a double

errorsdate={} is not a date

errorsrange={} is not in the range {} through {}

errorscreditcard={} is an invalid credit card number

errorsemail={} is an invalid email address

buttonsubmit=Submit

buttonreset=Reset

buttoncancel=Cancel

labelusername=UserName:

labelpassword=Password:

loginformerrorusername=please enter your username

loginformerrorpassword=please enter your password

loginformfail=invalidation name and passwordlogin error!

中文的资源文件applicationResource_zh_CNproperties

errorsrequired={} 是必须的

errorsminlength={} 不能少于 {} 个字符

errorsmaxlength={} 不能多于 {} 个字符

errorsinvalid={} 是非法的

[] [] [] [] [] [] [] []

               

上一篇:Struts从零开始五、Struts中验证数据实例[7]

下一篇:Struts从零开始五、Struts中验证数据实例[5]