In my WEB-INF/classes folder I have two files: ofmResoures.properties and ofmResources_de.properties. In my Action, I have the following:
MessageResources mr = getResources(request); myActionForm.setMessage(mr.getMessage("DE", "messages.deleteFailed"));
the mr.getMessage() call returns null though. If I take out the locale specification, it does work, pulling the value out of ofmResources.properties. I've tried the locale in upper and lower-case, makes no difference.
Do you need to pass ALL the resource filenames as init params in web.xml? I had been assuming that just passing "ofmResources" as I've done would be enough for the servlet to also load all the locale-specific versions, but maybe that's a bad assumption? Does anyone know? Thanks!
From: "Ivan" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: Re: Accessing ResourceBundle items from Action class Date: Thu, 13 May 2004 09:37:47 +0200
I want to share mine :^)
[...]
/* Guardo los mensajes */ PropertyMessageResources messages = (PropertyMessageResources)request.getAttribute("org.apache.struts.action.MES SAGE"); Locale locale = (Locale)session.getAttribute(Globals.LOCALE_KEY);
[...]
this.seleccio = messages.getMessage(locale,"etiqueta.enregistramentPersonal.intern");
is it correct?
----- Original Message ----- From: "None None" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 12, 2004 10:11 PM Subject: Re: Accessing ResourceBundle items from Action class
> (in my best StrongBad voice)... That's right, bow to my awesome
> superiorityness ;)
>
> Seriously though, I've been getting a ton of help from people on this list
> the past few days as I go through the exercise of learning Struts, so if I
> can give back even a little, that's very cool in my book.
>
> >From: Riyad Kalla <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: Accessing ResourceBundle items from Action class
> >Date: Wed, 12 May 2004 13:05:50 -0700
> >
> >On Wednesday 12 May 2004 01:04 pm, None None wrote:
> > > Thank you for that answer Riyad. I think I actually found another
> > > (better?) way in my stumbling about trying to solve it on my own...
> >
> >No you didn't, mine is the BEST :*D
> >
> > >
> > > All I did is in my Action, after all my real processing, is this:
> > >
> > > MessageResources mr = getResources(request);
> > > lpcaf.setMessage(mr.getMessage("messages.deleteFailed"));
> > >
> > > where lpcaf is the ActionForm from the form submission. That seems to
> >do
> > > precisely what I want.
> >
> >oh... yea your way IS better! Thanks for sharing, now I know.
> >
> >Best,
> >Riyad
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _________________________________________________________________
> Getting married? Find tips, tools and the latest trends at MSN Life
Events.
> http://lifeevents.msn.com/category.aspx?cid=married
>
>
> ---------------------------------------------------------------------
> 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]
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]