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.
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 12:53:42 -0700
I swear I answered this question yesterday.... yes I did, but it was from someone else:
------------------
You could subclass the ActionServlet with your own instance that in its init
method reads the properties file...
I think this should do the trick, please fix the path when necessary: Properties properties = new Properties().load(MyActionServlet.getClass().getResourceAsStream("ApplicationResources.properties"); --------------------
On Wednesday 12 May 2004 12:51 pm, None None wrote:
> Hello all. I have in my app a resouce bundle, and I can use it in my JSP's
> no problem... my question though is how can I access those items from an
> Action?
>
> Specifically, I have some error messages that I want to return to the view.
> At present they are hardcoded in my Action classes and they are displayed
> via onLoad of my JSP with a simple JavaScript alert. I'd like to have
> those error messages in my resource bundle and be able to return a specific
> key as my error message from various Action classes.
>
> Any help is appreciated. Thanks all!
>
> Frank
>
> _________________________________________________________________
> MSN Toolbar provides one-click access to Hotmail from any Web page – FREE
> download! http://toolbar.msn.com/go/onm00200413ave/direct/01/
>
>
> ---------------------------------------------------------------------
> 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]
_________________________________________________________________
Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage! http://join.msn.com/?pgmarket=en-us&page=hotmail/es2&ST=1/go/onm00200362ave/direct/01/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]