Struts2 Validator is the xwork inside of the validation, custom validator is based on the source code inherits existing field validator. The specific steps are as follows:
1. Expand the Xwork-2.0.4.jar,com.opensymphony.xwork2.validator.validators directory to have a default.xml, copy it to the project root directory renamed Validators.xml.
The validation framew
This article describes how to use the zf framework validator (user-defined validator and validator chain). For more information, see
The code is as follows:
Require_once ("Zend/Loader. php ");
// Introduce the validator class and the validator function class (Int), and the
Use of the ZF framework Validator [custom validator and validator chain]
Homework
Require_once ("Zend/Loader. php ");
// Introduce the validator class and the validator function class (Int), and the custom interface class;
Zend_Loader: loa
This article describes how to use the zf framework validator (User-Defined validator and validator chain). For more information, see
The Code is as follows:
Require_once ("Zend/Loader. php ");// Introduce the validator class and the validator function class (Int), and th
Copy codeThe Code is as follows:Require_once ("Zend/Loader. php ");// Introduce the validator class and the validator function class (Int), and the custom interface class;Zend_Loader: loadClass ('zend _ validate ');Zend_Loader: loadClass ('zend _ Validate_Int ');Zend_Loader: loadClass ('zend _ Validate_Interface ');// Added the UDF class GongBeiNum [Public multiple]Class GongBeiNum implements Zend_Validate_
entering the credit card number value), email (for entering the email address value), and so on.Create form BeanTo use validator, the form bean of your application must be a subclass of validator's actionform, rather than the actionform itself. The actionform subclass of validator provides the implementation process of the validate () method of actionform (which
, you do not have to modify this pre-configuration copy unless you want to add custom verification to the framework.
Listing 1Is an example validator-rules.xml file that describes how to insert a validation routine into validator. Each validation routine in the validator-rules.xml file has its own definition, which is declared with
Preface
Ease of use is the goal of the. NET validator verification framework. Based on the attribute validators identification and rich verification return types, it provides scalable validators interface... -- another wish and idea start, happy ing :)
Body
I,Framework Introduction
This framework matches the property name, the key in form and querystring, And the ID of the server-side control based on the attribute
This example describes the Yii2 validator (Validator) usage. Share to everyone for your reference, as follows:
Let's take a look at the validator's use.
Public Function Rules () { return [[ ' email ', ' password '], ' required '], [' Password ', ' string ', ' min ' =>6 ], ];}
As shown above, the validator is primarily used in the rules, validating the va
basic data types, time, e-mail, credit card, and other formats.
1. org. Apache. commons. validator. util. flagsThis class is used to manage a series of flags. The value of each flags is the Npower of 2. Then the bitwise AND () between each flag gets the value of the entire flags.
2. org. Apache. commons. validator. util. validatorutilsThis class provides some ut
Hibernate Validator Useimport Validation-api-xxx.jar and hibernate-validator-xxx. Final.jarJava Bean Entity.java to checkImport Javax.validation.constraints.max;import Org.hibernate.validator.constraints.length;public class Entity {@Max (value=3)//maximum value is 3private int age; @Length (max=1)///String length maximum is 1,hibernate extended private string name;public int getage () {return Age;} public v
The example in this article describes the Yii2 Validator (Validator) usage. Share to everyone for your reference, specific as follows:
First look at the use of the validator.
Public Function rules () {return [[
' email ', ' password '], ' required '],
[' Password ', ' string ', ' min ' = >6],
];
}
As shown above, the
Copy Code code as follows:
Require_once ("zend/loader.php");
The introduction of the validator class and the function Class (INT) of the calibrator, and the custom interface class;
Zend_loader::loadclass (' zend_validate ');
Zend_loader::loadclass (' Zend_validate_int ');
Zend_loader::loadclass (' Zend_validate_interface ');
Add custom Validator Feature Class (gongbeinum) [Common multiple]
Class
Implementation Code of the vue + vue-validator form verification function, vuevue-validator
Official documents: http://vuejs.github.io/vue-validator/zh-cn/index.html
Github address: https://github.com/vuejs/vue-validator
The following describes the vue + vue-validator form v
Verification of forms has always been a headache for web designers, and the form validation class validator is written to address this issue, designed to liberate designers from the complexities of form validation and focus on web design and functional improvements.
Validator is a custom property of a pseudo static class and object based on JavaScript technology, which validates the form entry in a Web pag
In the background development process, the validation of parameters becomes an indispensable part of the development environment. For example, the parameter can not be null,email so must conform to the format of email, if manually make if judgment or write regular expression to judge the unintended development efficiency is too slow, in time, cost, quality of the game will inevitably lag behind. So the verification layer is the inevitable result of abstraction, the following is a few solutions.T
The structure of the validation. xml file is defined by the validator_1_1_3.dtd file. The content of the file header is as follows:
"-// Apache Software Foundation // DTD commons validator rules configuration 1.1.3 // en"
Http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd>
The top-level element is
..............
The attributes are described as follows:
L name: indicates that the form name is the s
In struts, validator is very useful. It can help users get away from tedious page verification work and put the page verification work in the configuration file, struts has the following built-in validators that we often use:
· The validatebyte check value can be safely converted to byte· Validatecreditcard is a valid credit card number.· The validatedate check value is a valid date.· Validatedouble check v
are separated by commas.
MSG attribute: the MSG attribute specifies the Message key from the resource bundle. When the verification fails, the validator framework searches for the matched message text in the resource bundle Based on the Message key.
Depends attribute: The depends attribute specifies other verification rules that must be called before the current verification rule is called.
The validator f
, float, double
Test whether the value can be converted to the corresponding basic data type
Creditcard
Check whether the input domain is a valid credit card number.
Date
Checks whether the input field is a valid date.
Email
Check whether the input is a valid email address.
Mask
Checks whether the input field matches a regular expression.
Maxlength
Whether the length of the test value is s
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.