Java Reference
In-Depth Information
fieldName: The name of the field that is in error. This name corre-
sponds to the
name=
attribute of the form control, such as
con-
tact.firstName
.
errorName: The name associated with the type of validation that caused
the error. Each built-in validation has a specific errorName. For
example, the errorName for
@Validate(required=true)
is
valueNotPre-
sent
.
defaultScope: Like errorName, the defaultScope is associated with a
type of validation, such as
validation.required
for
@Validate(required=
true)
.
Here are the combinations of these values that Stripes uses when it
searches through the resource bundle:
actionBeanFullName.fieldName.errorName
actionBeanFullName.fieldName.
errorMessage
fieldName.errorName
fieldName.
errorMessage
actionBeanFullName.errorName
actionBeanFullName.
errorMessage
defaultScope.errorName
For example, when a
@Validate(required=true)
validation fails for the
con-
tact.email
field
in
stripesbook.action.ContactFormActionBean
,
Stripes
searches for the following keys:
stripesbook.action.ContactFormActionBean.contact.email.valueNotPresent
stripesbook.action.ContactFormActionBean.contact.email.errorMessage
contact.email.valueNotPresent
contact.email.errorMessage
stripesbook.action.ContactFormActionBean.valueNotPresent
stripesbook.action.ContactFormActionBean.errorMessage
validation.required.valueNotPresent
Stripes uses the first matching key or throws an exception if no key is
found. As mentioned earlier,
StripesResources.properties
comes with mes-
sages for every built-in validation using the last key in the search list,
defaultScope.errorName.
Search WWH ::
Custom Search