I do the following in the perform method of my action classes:

//Load our message resources
MessageResources messages    = getResources();
String message = messages.getMessage("messageString");

This works for me. I hope it helps!!!

**********************************************
Juan Alvarado
Internet Developer -- Manduca Management
(786)552-0504
[EMAIL PROTECTED]
AOL Instant Messenger: [EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 01, 2002 11:08 AM
To: Struts Users Mailing List
Subject: Re: Get MessageResource in ActionForm


"Struts Newsgroup (@Basebeans.com)" wrote:

> can someone give me a hint, how i can access MessageResources (From
> ApplicationResources.properties) within a Subclass of ActionForm???
>
> My prpoblem is, the ActionForm does not know anything about the
> ActionServlet, and so I have no Chance to get the Messages within
> ActionForm.
>
> I tried this:
> servlet.getMessageResources().getMessage("STRING_TO_LOOK_UP");
>
> But "servlet" and "getServlet" returns null.

Are you using the nightly build?  One used to be able to use
getServlet().getResources() from an ActionForm, but
ActionServlet.getResources
has been deprecated.  Last time I tried it, it didn't seem to be working any
longer either.

Currently I'm getting the resources by calling
"request.getAttribute(Action.MESSAGES_KEY)".

Bruce


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



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

Reply via email to