You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by None None <fz...@hotmail.com> on 2004/05/12 21:51:45 UTC
Accessing ResourceBundle items from Action class
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Accessing ResourceBundle items from Action class
Posted by Riyad Kalla <rs...@email.arizona.edu>.
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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org