Re: Best way to substitute vars in message resources
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 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]
Re: Best way to substitute vars in message resources
Brian McGovern wrote the following on 2/18/2005 9:05 AM: 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? In struts resources file: -- label.dork.name={0} {1} Is Dork Of The World on JSP -- JSTL way: Struts bean:message -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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