You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ahmed Hashim <en...@gmail.com> on 2006/08/14 10:09:16 UTC

Using Resource Bundle

Dear All,
I want to know if I can use the resource bundle defined in struts-config
from Action Class
I can use it in JSP using JSTL or struts tag lib, but for some reason I want
to use it from the Action class
Is there any way I can use it without making new instance from the resource
file? I keen about performance.

this way

ResourceBundle bundle = ResourceBundle.getBundle("
com.language.Resources.properties");
String testValue = bundle.getString("key.key1");

but I knew that this way will load the resource file again! which is not so
good for me.

Thanks

Ahmed Hashim
http://www.egjug.org
-- 
In Life, it doesn't matter who you are, but whether someone appreciates you
for what you are, accepts you and loves you unconditionally. A Real Friend (
Friendship ) is one who walks in when the rest of the world walks away.

Re: Using Resource Bundle

Posted by Daan <da...@gmail.com>.
See the getResources(HttpServletRequest request) in the Action class

Regards

On 8/14/06, Ahmed Hashim <en...@gmail.com> wrote:
>
> Dear All,
> I want to know if I can use the resource bundle defined in struts-config
> from Action Class
> I can use it in JSP using JSTL or struts tag lib, but for some reason I
> want
> to use it from the Action class
> Is there any way I can use it without making new instance from the
> resource
> file? I keen about performance.
>
> this way
>
> ResourceBundle bundle = ResourceBundle.getBundle("
> com.language.Resources.properties");
> String testValue = bundle.getString("key.key1");
>
> but I knew that this way will load the resource file again! which is not
> so
> good for me.
>
> Thanks
>
> Ahmed Hashim
> http://www.egjug.org
> --
> In Life, it doesn't matter who you are, but whether someone appreciates
> you
> for what you are, accepts you and loves you unconditionally. A Real Friend
> (
> Friendship ) is one who walks in when the rest of the world walks away.
>
>