Java Reference
In-Depth Information
The following table shows the defaultScope and errorName for each
built-in validation and type converter:
Validation
defaultScope
errorName
required=true
validation.required
valueNotPresent
minlength=N
validation.minlength
valueTooShort
maxlength=N
validation.maxlength
valueTooLong
minvalue=N
validation.minvalue
valueBelowMinimum
maxvalue=N
validation.maxvalue
valueAboveMaximum
mask="M"
validation.mask
valueDoesNotMatch
expression="E"
validation.expression
valueFailedExpression
Type Converter
DateTypeConverter
converter.date
invalidDate
EmailTypeConverter
converter.email
invalidEmail
EnumeratedTypeConverter
converter.enum
notAnEnumeratedValue
Number TypeConverter
1
converter.number
invalidNumber
converter.type
2
Number TypeConverter
outOfRange
PercentageTypeConverter
converter.number
invalidNumber
PercentageTypeConverter
converter.type
outOfRange
To change the text of an error message, change the corresponding entry
in the
StripesResources.properties
file, or add a new entry. We can use
a key that is as specific or as general as we want. For example, the
following
stripesbook.action.ContactFormActionBean.contact.email.valueNotPresent
is most specific, while the following
validation.required.valueNotPresent
is most general. We can use the
{0}
and
{1}
tokens to include the field
label and the value entered by the user in the error message text.
Certain validators and type converters provide additional parameters,
starting at
{2}
, as shown here in the table on the next page.
1. Number
refers to each number type converter:
ByteTypeConverter
,
IntegerTypeConverter
,
and so on.
2.
type
refers to the number type, as in
converter.byte
,
converter.integer
, and so on.
Search WWH ::
Custom Search