STRUTS2 Calibrator--Regular Expression Checker (regex)

Source: Internet
Author: User
Tags cdata

The name of the regular expression validator: Regex, he checks whether the field of the checksum is matched by a regular expression

Parameters:

FieldName: This parameter specifies the name of the Action property of the checksum, and if the field checksum style is used, it is not necessary to specify the parameter; expression: Optionally, this parameter specifies a matching regular expression; Casesemsitive: Optionally, this parameter indicates that a regular expression match is case sensitive, default true

Use a non-field validator configuration format, sample configuration:
<validators>
<!--using a non-field validator format; To configure the regular expression Checker-->
<validator type= "Regex" >
<!--Specify a validation field: User-->
<param name= "FieldName" >user</param>
<!--specify a matching regular expression-->
<param name= "expression" ><! [Cdata[(/w{4,20})]]</param>
<!--specify prompt for checksum failure-->
<message> username must be between 4 and 20, and must be a letter or number </message>
</validator>
........................
</validators>

Configure the format with field validators, and configure the example:

<validators>
<!--use field validator format to configure the regular validator to verify the user property-->
<field name= "User" >
<field-validator type= "Regex" >
<!--specify a matching regular expression-->
<param name= "expression" ><! [Cdata[(/w{4,20})]]</param>
<!--specify prompt for checksum failure-->
<message> username must be between 4 and 20, and must be a letter or number </message>
</field-validator>
............................
</field>
.................
</validators>

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.