You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Norris Shelton <no...@yahoo.com> on 2009/05/14 16:56:23 UTC
[S2] Annotation Validation - string substitution in message
I am using the following annotation for validation:
@RequiredStringValidator(key = "required.string.message")
I have the following in my globalMessages:
required.string.message=${string.name} is required
Is there a way to substitute the name of the field or a string that I specify take the place of ${string.name}? For example, I would like to see "Team Name is required".
Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Shelton Consulting, LLC
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton
Re: [S2] Annotation Validation - string substitution in message
Posted by Dave Newton <ne...@yahoo.com>.
Norris Shelton wrote:
> I need some clarification.
>
> I should have the following in my globalMessages?
> required.string.message=${get(fieldName)} is required
>
> How would I specify field name?
Hmm, in retrospect, I don't know if this technique works with
annotations. With XML validation "fieldName" is exposed by the
validator. Not sure if the same is true with annotations, so this may
not work.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Annotation Validation - string substitution in message
Posted by Norris Shelton <no...@yahoo.com>.
I need some clarification.
I should have the following in my globalMessages?
required.string.message=${get(fieldName)} is required
How would I specify field name?
Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Shelton Consulting, LLC
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton
________________________________
From: Dave Newton <ne...@yahoo.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Thursday, May 14, 2009 3:13:53 PM
Subject: Re: [S2] Annotation Validation - string substitution in message
Norris Shelton wrote:
> I am using the following annotation for validation:
> @RequiredStringValidator(key = "required.string.message")
>
> I have the following in my globalMessages:
> required.string.message=${string.name} is required
>
> Is there a way to substitute the name of the field or a string that I specify take the place of ${string.name}? For example, I would like to see "Team Name is required".
${getText(fieldName)}
(more or less, and there should be a key of the field name defined.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Annotation Validation - string substitution in message
Posted by Dave Newton <ne...@yahoo.com>.
Norris Shelton wrote:
> I am using the following annotation for validation:
> @RequiredStringValidator(key = "required.string.message")
>
> I have the following in my globalMessages:
> required.string.message=${string.name} is required
>
> Is there a way to substitute the name of the field or a string that I specify take the place of ${string.name}? For example, I would like to see "Team Name is required".
${getText(fieldName)}
(more or less, and there should be a key of the field name defined.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org