List of Some Built-in Data Validators

Validator NameClass NameValidation
requiredRequiredFieldValidatorIf field is not null
requiredstringRequirredStringValidatorIf string not-null and contains length > 0
stringlength validatorStringLengthFieldValidatorIf String field is of a certain length based on minlenth and maxlength specified
email validatorEmailValidatorIf field contains valid email address
date validatorDateRangeFieldValidatorif the date field is within a specified parameter range
conditionalvisitorConditionalVisitorFieldValidatorConditional validator will forward the request to the conditionalfield validator if the expression is true
ExpressionExpressionValidatorValidated based on regular expression supplied
fieldExpressionFieldExpressionValidatorValidates a field based on OGNL expression
DoubleDoubleRangeFieldValidatorif double within a certain range
urlURLValidatorIf the field value is valid URL
regexRegexFieldValidatorValidates a field based on regular expression

Struts2 Framework Annotation Based Validators

List of Annotation Based Validators

Annotation NameValidation
@RequiredStringValidatorIf the string is not null and length > 0
@RequiredFieldValidatorIf the string is not null
@EmailValidatorIf the field is valid email address
@RegexFieldValidatorIf the field matches the provided regular expression
@IntRangeFieldValidatorIf the numeric field is within specified range
@StringLengthFieldValidatorIf the field length is within the specified minimum and maximum length
@DateRangeFieldValidatorIf the date field is within specified range
@FieldExpressionValidatorIf the field matches the provided OGNL expression
DoubleDoubleRangeFieldValidator
urlURLValidator
regexRegexFieldValidator