Yes, the {0} {1}.... {n} construct will work.  The ActionMessage class has an 
overloaded constructor to handle the substitution.

http://struts.apache.org/api/org/apache/struts/action/ActionMessage.html

I use this all over the place - works great.  Make sure you "save" the messages 
to the request context.  You can do the same with errors messages.

Jim

-----Original Message-----
From: Brian McGovern <[EMAIL PROTECTED]>
Sent: Feb 18, 2005 9:05 AM
To: Struts Users Mailing List <user@struts.apache.org>
Subject: Best way to substitute vars in message resources

I want to frame out messages in Application.properties like this:

err.userexists=The user __UserName__ already exists. Please try again.

What im wondering about is if there is either a built in mechanism in struts to 
handle that __UserName__ replacement.  Maybe {0} or something?  Or should I 
just do a manual string replace hack in my controller?

Thanks
-B


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to