`
ningzai
  • 浏览: 72033 次
  • 性别: Icon_minigender_1
  • 来自: 珠海
最近访客 更多访客>>
社区版块
存档分类
最新评论

验证框架

阅读更多
<form-validation>

   <global>

      <validator name="required"//必需的
            classname="org.apache.struts.validator.FieldChecks"
               method="validateRequired"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
                  msg="errors.required"/>

      <validator name="requiredif"
                 classname="org.apache.struts.validator.FieldChecks"
                 method="validateRequiredIf"
                 methodParams="java.lang.Object,
                               org.apache.commons.validator.ValidatorAction,
                               org.apache.commons.validator.Field,
                               org.apache.struts.action.ActionMessages,
                               org.apache.commons.validator.Validator,
                               javax.servlet.http.HttpServletRequest"
                 msg="errors.required"/>

      <validator name="validwhen"
          msg="errors.required"
                 classname="org.apache.struts.validator.validwhen.ValidWhen"
                 method="validateValidWhen"
                 methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"/>


      <validator name="minlength"最小长度
            classname="org.apache.struts.validator.FieldChecks"
               method="validateMinLength"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.minlength"
           jsFunction="org.apache.commons.validator.javascript.validateMinLength"/>


      <validator name="maxlength"最大长度
            classname="org.apache.struts.validator.FieldChecks"
               method="validateMaxLength"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.maxlength"
           jsFunction="org.apache.commons.validator.javascript.validateMaxLength"/>



      <validator name="mask" 合理性
            classname="org.apache.struts.validator.FieldChecks"
               method="validateMask"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.invalid"/>


      <validator name="byte"字符型
            classname="org.apache.struts.validator.FieldChecks"
               method="validateByte"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.byte"
       jsFunctionName="ByteValidations"/>


      <validator name="short"短整型
            classname="org.apache.struts.validator.FieldChecks"
               method="validateShort"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.short"
       jsFunctionName="ShortValidations"/>


      <validator name="integer"整型
            classname="org.apache.struts.validator.FieldChecks"
               method="validateInteger"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.integer"
       jsFunctionName="IntegerValidations"/>



      <validator name="long"长整型
            classname="org.apache.struts.validator.FieldChecks"
               method="validateLong"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.long"/>


      <validator name="float"浮点型
            classname="org.apache.struts.validator.FieldChecks"
               method="validateFloat"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.float"
       jsFunctionName="FloatValidations"/>

      <validator name="double"双字符
            classname="org.apache.struts.validator.FieldChecks"
               method="validateDouble"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.double"/>


      <validator name="date"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateDate"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.date"
       jsFunctionName="DateValidations"/>


      <validator name="intRange"整型变化
            classname="org.apache.struts.validator.FieldChecks"
               method="validateIntRange"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends="integer"
                  msg="errors.range"/>


      <validator name="floatRange"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateFloatRange"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends="float"
                  msg="errors.range"/>

      <validator name="doubleRange"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateDoubleRange"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends="double"
                  msg="errors.range"/>


      <validator name="creditCard"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateCreditCard"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.creditcard"/>


      <validator name="email"电子邮件验证
            classname="org.apache.struts.validator.FieldChecks"
               method="validateEmail"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.email"/>

      <validator name="url"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateUrl"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.url"/>

     <!--
       This simply allows struts to include the validateUtilities into a page, it should
       not be used as a validation rule.
     -->
     <validator name="includeJavaScriptUtilities"
            classname=""
               method=""
         methodParams=""
              depends=""
                  msg=""
           jsFunction="org.apache.commons.validator.javascript.validateUtilities"/>

   </global>

</form-validation>
分享到:
评论

相关推荐

    一个既简单的校验框架

    本篇将深入探讨一个基于Java的简单校验框架的实现,该框架充分利用了注解和反射技术,旨在提供一种优雅且可扩展的解决方案。 首先,我们来理解注解(Annotation)在Java中的作用。注解是一种元数据,它提供了在源...

    Struts2自定义校验框架

    下面将详细介绍Struts2自定义校验框架的相关知识点。 1. **Struts2验证框架概述** Struts2的验证框架主要负责处理用户提交的数据,进行验证,并在验证失败时显示错误消息。它支持两种验证方式:基于注解的验证...

    jsvalidation 强大而灵活的表单客户端验证框架

    JSValidation是强大灵活的客户端验证框架。在应用服务器或者开发框架不提供验证的情况下,例如,普通的JSP, ASP, PHP等开发,以及一些不提供验证支持的开发框架,如Tapestry, Velocity等,JSValidation提供了一种...

    Struts2校验框架应用

    Struts2作为一款流行的Java Web开发框架,提供了一套强大的校验框架,使得开发者能够方便地对用户输入数据进行验证,确保数据的准确性和安全性。本文将深入探讨Struts2校验框架的应用,包括其核心概念、配置方式、...

    各种输入框动态校验框架

    "各种输入框动态校验框架"这个标题揭示了我们讨论的主题是关于不同类型的输入验证解决方案,它们可以提供实时反馈,帮助用户在输入时即时修正错误,提升用户体验。 描述中的“输入内容自动提示”意味着框架具备智能...

    数据校验框架在hybris中的使用

    本文将详细介绍如何在Hybris中利用数据校验框架进行有效的数据验证。 1. 背景 在传统的开发方式中,数据校验通常通过编写if语句来实现,这不仅增加了代码量,而且难以维护。在接口开发中,针对各种请求数据的格式...

    强大的表单验证框架

    "强大的表单验证框架"标题所指的,很可能是用于简化这一过程的高效工具,旨在帮助开发者更方便、更有效地进行表单数据验证。 表单验证框架通常包含以下核心功能: 1. **规则定义**:提供丰富的验证规则,如非空、...

    很不错的验证框架jquery

    在实际开发中,除了jQuery Validation Plugin,还有其他类似的选择,例如React、Vue或Angular等现代前端框架自带的验证库,它们提供了更加原生和组件化的验证方式,如Formik(React)、Vee-Validate(Vue)和ng-...

    jQuery好的验证框架

    **jQuery验证框架** jQuery是一个广泛使用的JavaScript库,它极大地简化了HTML文档遍历、事件处理、动画和Ajax交互。在Web开发中,数据验证是必不可少的一环,用于确保用户输入的有效性和安全性。jQuery验证框架...

    struts2.0的数据校验框架struts2.0的数据校验框架

    struts2.0的数据校验框架struts2.0的数据校验框架struts2.0的数据校验框架struts2.0的数据校验框架

    struts2校验框架使用心得.txt

    其中,Struts2提供的校验框架是其核心特性之一,能够有效地进行表单验证,并且支持多种验证方式。 #### 二、配置Struts2框架 为了使用Struts2框架,首先需要在项目的`web.xml`文件中配置过滤器。下面的示例展示了...

    Hibernate Validator校验框架

    综上所述,Hibernate Validator 是一个强大的校验框架,它为 Java 应用提供了标准化的数据验证方案,简化了验证逻辑的实现,提高了代码的可维护性和一致性。通过与 Spring 等框架的整合,可以轻松地在 Web 开发中...

    Struts验证框架配置详解

    Struts验证框架是Java Web开发中的一个重要组成部分,它主要用于确保用户输入的数据符合应用程序设定的规则,从而提高数据的准确性和安全性。本篇文章将深入探讨Struts验证框架的配置过程,帮助开发者更好地理解和...

    jquery 前端验证框架

    **jQuery前端验证框架详解** 在Web开发中,前端验证是必不可少的一个环节,它能有效防止无效数据提交到服务器,提高用户体验并减轻服务器负担。jQuery,作为一款广泛使用的JavaScript库,提供了许多工具和插件来...

    .net winform 数据验证框架

    《.NET WinForm数据验证框架详解》 在.NET框架中,Windows Forms(WinForm)是开发桌面应用程序的常用工具,而数据验证则是确保用户输入准确无误的关键环节。本篇文章将深入探讨一个基于C#的.NET WinForm数据验证...

    JSP客户端表单验证框架JSValidation

    **JSP客户端表单验证框架JSValidation** JSValidation是一款基于JavaScript的轻量级表单验证框架,主要用于在JSP(JavaServer Pages)应用中实现客户端的表单数据验证。它提供了一种简单、高效的手段来确保用户在...

    struts1验证框架相当好的经典例子

    在Struts1中,验证框架是处理用户输入数据校验的重要组成部分,它帮助开发者确保用户提交的数据符合预定义的规则,从而提高应用程序的安全性和用户体验。下面将详细介绍Struts1验证框架的使用。 首先,我们来看一下...

    stuts验证框架与国际化

    Struts验证框架是Struts的一部分,它为开发者提供了处理用户输入验证的强大工具,帮助确保从客户端接收到的数据是合法且符合业务规则的。在Web开发中,验证是非常关键的一环,因为无效或恶意的数据可能会导致各种...

Global site tag (gtag.js) - Google Analytics