摘要
无论是自动产生还是用户输入的数据,都要验证它的完整性和有效性。这项工作可能非常繁琐,因为数据可能有不同的类型和格式。随着MVC设计模式的流行,Struts框架的应用越来越广泛,在程序设计过程中Struts的验证框架也就必然因其安全、可配置变得广泛起来。Struts的Validator验证框架定义了十几种常用的验证规则,如required(验证非空)、minlength(验证最小长度)、maxlength(验证最大长度)、intRange(验证数据范围)、email(验证电子邮件地址)、date(验证日期)等。这对于提高验证效率和数据验证安全性提供了很好的实现,但这并不能实现一些较普遍而且标准的数据验证需求。本文章主要是通过扩展Struts验证框架实现对专业标准化数据的验证。
System must verify the integrity and effectiveness of the data either automatically generated or user inputed. This work will be complicated, since system data may have different types and formats. With the popularity of MVC design pattern, struts framework are usded widely with its validation framework because of the safety and configable. Struts validator framework defines a dozen commonly used validation rules such as required (verify non-empty), minlength (verify minimum length), maxlength (verify maximum length), intRange (verify data range), email (e-mail verification ), date (verify date). This will improve the verification efficiency and security, but can not achieve some more common and standard data validation requirements. This article is focus on how to verify standard data type by extending the struts validation framework.
出处
《微计算机信息》
2010年第27期126-127,149,共3页
Control & Automation
基金
基金申请人:姜利群
项目名称:程序的异常传播分析技术研究
基金颁发部门:教育部科学技术研究重点项目(108063)