required
|
Checks that a field value is non-null and not an empty string.
|
requiredif
|
Only available for Struts 1.1. This validator allows one field to be specified as required if another field is null, not null, or equal to a specified value. This validator is deprecated, in favor of validwhen, in releases after Struts 1.1.
|
validwhen
|
Designed to replace requiredif, this validator is available in releases after Struts 1.1. This validator relies on a user-specified test expression that can include references to other fields, field values, and logical relationships.
|
minlength
|
Checks that the number of characters in the field value is greater than or equal to a specified minimum.
|
maxlength
|
Checks that the number of characters in the field value is less than or equal to a specified maximum.
|
mask
|
Validates the field value using a regular expression to determine a match. If the value matches the regular expression, the field is valid.
|
byte
|
Checks that the field value is a valid byte value.
|
short
|
Checks that the field value is a valid short integer value.
|
integer
|
Checks that the field value is a valid integer value.
|
long
|
Checks that the field value is a valid long value.
|
float
|
Checks that the field value is a valid floating-point value.
|
double
|
Checks that the field value is a valid double value.
|
date
|
Checks that the field value matches a specified date format pattern (e.g., MM/dd/yyyy). The match can be strict or lenient; "strict" would require May 10, 1963 to be formatted (using the MM/dd/yyyy pattern) as 05/10/1963; "lenient" would allow 5/10/1963.
|
range
|
Checks that the field value is within a specified numeric range. This valdiator has been deprecated in favor of the type-specific range checks (intRange, floatRange, etc.).
|
intRange
|
Checks that the field value is within a range bounded by two int values.
|
floatRange
|
Checks that the field value is within a range bounded by two float values.
|
doubleRange
|
Checks that the field value is within a range bounded by two double values.
|
creditCard
|
Verifies that the format of the field value is valid for a credit card number. This validator is convenient to use instead of using mask.
|
email
|
Verifies that the format of the field value is valid for an electronic mail address (e.g., foo@bar.com). This validator is convenient to use instead of working with mask.
|
url
|
Verifies that the value entered is a valid uniform resource locator. Use this validator when you want to validate an input web location or hyperlink value.
|
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>
|
form
元素中的
name
属性指定要验证的表单名而不是类。
|