读书人

Struts的Validator证验框架使用教程

发布时间: 2012-06-26 10:04:13 作者: rapoo

Struts的Validator验证框架使用教程


一、验证有很多种:

1.最开始接触的js验证客户端验证

2.服务器端验证

2.1.在FormBean中验证(本例中采用的便是FormBean中使用Validator验证格式)

2.2.Action业务逻辑层验证(比如用户名在数据库中是否存在等等)

3.采用Ajax在异步的情况下进行客户端和服务器同时的验证



[color=green]

二、步骤:

1.建立web项目struts_validator添加struts(1.2)支持

2.右击项目-->new-->other-->myeclipse-->web-struts-->struts1.2-->Strurs1.2 Form ,Action & JSP;supclass:ValidatorForm;再添加一些属性,跳转些...

3.打开validator-rules.xml将一下代码添加到struts-config.xml中


4.打开validator-rules.xml将一下代码添加到ApplicationResources.properties中,当然你可以根据需要修改资源文件

7.部署运行:http://localhost:8080/struts_validator_3/regist.jsp

8.查看附件


[/color]


.



读书人网 >软件架构设计

热点推荐