Try this: MessageResources resources= (MessageResources) request.getAttribute(Globals.MESSAGES_KEY); Locale loc = getTheLocale(request); String value = resources.getMessage(loc, your_key_for_bert) ;
You could get locale using RequestUtils.getUserLocale(...) ----- Original Message ----- From: "Arash Bijanzadeh" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <user@struts.apache.org> Sent: Tuesday, June 21, 2005 3:26 PM Subject: Re: Accessing message resource from in validate method Sure, My problem is how to fetch the "Bert" from resource bundle. Because it must shown in a localized manner :-) On 6/21/05, Marsh-Bourdon, Christopher <[EMAIL PROTECTED]> wrote: > > ActionMessage bert = new ActionMessage("Here {0}, thi is the place.", > "Bert"); > > Will produce: > > Here Bert, thi is the place. > > Cheers > > Christopher Marsh-Bourdon > www.marsh-bourdon.com <http://www.marsh-bourdon.com> > > > -----Original Message----- > From: Arash Bijanzadeh [mailto:[EMAIL PROTECTED] > Sent: 21 June 2005 13:10 > To: Struts Users Mailing List > Subject: Re: Accessing message resource from in validate method > > My problem is creating a message with an argument for example: > Date {0} is not valid. > I create: > msg.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.badDate > ")); > My Question : how can I add the argument for {0} from resource bundle to > this statement, as validator framewoek does? > Regards, > arash > > On 6/21/05, Jana Parvanova <[EMAIL PROTECTED]> wrote: > > > > ActionMessage is constructed with message key, not with message text - > > so you don't have to access resources directly. > > Or, maybe I have not understood your question? > > > > ----- Original Message ----- > > From: "Arash Bijanzadeh" <[EMAIL PROTECTED]> > > To: <user@struts.apache.org> > > Sent: Tuesday, June 21, 2005 11:44 AM > > Subject: Accessing message resource from in validate method > > > > > > Hi, > > In the validate method of ActionForm, I need to access the resource > > messages to pass the message as arg to ActionMessage constructor. > > Could anybody help me? > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > ------ > > > > -------------------------------------------------------------------------- ------ > The information contained herein is confidential and is intended solely > for the > addressee. Access by any other party is unauthorised without the express > written permission of the sender. If you are not the intended recipient, > please > contact the sender either via the company switchboard on +44 (0)20 7623 > 8000, or > via e-mail return. If you have received this e-mail in error or wish to > read our > e-mail disclaimer statement and monitoring policy, please refer to > http://www.drkw.com/disc/email/ or contact the sender. 3166 > > -------------------------------------------------------------------------- ------ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]