Hi,
   i am facing same problem with other message. i.e 

field.amount= {0} can not be ${1} for Sequence {2}.

On UI interface it is displaying below message:

Amount can not be 1 for Sequence 987654.

instead of 

Amount can not be $0.00 for Sequence 987654.

Means ${  is not working for any error message.

Parameter is passed currectly

addActionError(getText("field.amount", new String[] { "Amount", "0.00",
"987654"})); 

Any help would be greatly appreciated

Thanks 
Kamlesh




Chris Pratt wrote:
> 
> What do you mean by "not working"?  Are you seeing:
> 
> Field {0} is required.
> 
> on your interface?  If so, I suspect what you need to do is:
> 
> field.required=Field ''{0}'' is required.
> field.numeric=Field ''{0}'' must be a number.
> 
> Since the new code runs the messages through MessageFormat, and
> MessageFormat considers anything between apostrophe's to be a literal
> value,
> you have to use double apostrophe's to represent a single apostrophe in
> the
> output.
>   (*Chris*)
> 
> On Mon, May 4, 2009 at 12:27 PM, cm132005 <cm132...@gmail.com> wrote:
> 
>>
>> Hi,
>>
>> We are migrating our Struts 1.x application to Struts 2.1.6 and currently
>> we
>> are using Struts Validation framework where the parameterized error
>> messages
>> are picked up from the resource bundle.
>>
>> field.required=Field '{0}' is required.
>> field.numeric=Field '{0}' must be a number.
>>
>> Expected output:
>> Field 'First Name' is required.
>> Field 'Last Name' is required.
>> Field 'Age' must be a number.
>> Field 'Cost' must be a number.
>>
>> The parameter is not always an input value but a label or a String being
>> passed. It is working fine in Struts 1.x using ActionMessage:
>>
>> errors.add("fName", new ActionMessage("field.required", "First Name"));
>>
>> But not working in Struts 2 using getText():
>> //String getText(String key, List args);
>> //String getText(String key, String[] args);
>> addActionError(getText("field.name", new String[] { "First Name"}));
>>
>> Any help on how to achieve this in Struts 2 would be greatly appreciated.
>>
>> Thanks.
>> --
>> View this message in context:
>> http://www.nabble.com/Struts-2---Parameterized-error-messages-tp23374965p23374965.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Struts-2---Parameterized-error-messages-tp23374965p30748110.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to