struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Newton (JIRA)" <>
Subject [jira] Commented: (WW-2263) validation annotation message attribute required even if using key attribute
Date Sat, 21 Jun 2008 12:20:05 GMT


Dave Newton commented on WW-2263:

Oh, good; thanks! I kept forgetting to bring this up or fix it :(

> validation annotation message attribute required even if using key attribute
> ----------------------------------------------------------------------------
>                 Key: WW-2263
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.0.9
>         Environment: Debian Linux
>            Reporter: chad michael davis
>            Assignee: Rainer Hermanns
>             Fix For: 2.1.3
> This "bug" is about a quirky interface to validations using annotations.  In the XML,
the message element can contain the text of the message in its body, or omit the body and
use key attribute to name the key into the resource bundles for retrieving the message.  
> Under annotations, the message attribute is always required.  Seems like you should be
able to specify a key and drop the message attribute but you can't.  To specify a key you
must use the  key attribute ( note, key and message are sibling level attributes of the annotation
itself; this is different from the xml ) such as follows:
> @EmailValidator(type = ValidatorType.FIELD, key="email.invalid", message="Email no good.")
> In this annotation, I still have a message specified, as a back up I guess.  But if I
try to remove it altogether, the equivalent of what i do in XML with the following:
>   <field-validator type="requiredstring">
>          <message key="username.required"/>
>      </field-validator>
> Then it blows up.  i guess this isn't a bug, but it seems kind of odd, forcing the user
to specify a message text that won't be used ( a default message will be provided in the form
of the key string itself if the properties file is missing, right? ), and its clearly inconsistent
between the XML and the annotations

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message