struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Akins <angryg...@gmail.com>
Subject Re: Any way to load resources in java.util.ResourceBundle
Date Fri, 16 Jul 2010 11:57:58 GMT
I'm resurrecting this message because I have the same need.

I'm converting some code to Struts2, from a JSP/Servlet application.
Currently we create bundles from a database, that have keys per
customer and language for most of the text in our application.

A simple solution to this would be to override
LocalizedTextUtil.findDefaultText and add a call to our classes that
load the text into a ResourceBundle.

However it doesn't look like there is anyway, in Struts 2.1.8.1 to use
my own version of LocalizedTextUtil.

Does anyone have any thoughts on how I might do this?

On Wed, Jan 27, 2010 at 12:43 PM, Bhaarat Sharma <bhaarat.s@xxxxxxxxx>wrote:

> We have seen situations where sometimes the global resource bundles are
> lost intermittently for some sessions. We are in a clustered/shared
> environment where multiple apps are deployed onto a GlassFishV2 server.
> Multiple apps share the struts2 core jars.
>
> We have some pages where we have written a custom Resource loader and
> everything looks fine on these pages. Problem is on pages that utilize
> <s:text name="my.label.name"/>. Our properties files reside globally in
> WEB-INF/lib
>
> Our custom resource loader works as follows in a JSP
>
> <%CustomMessageResrouce cusResource = new
> CustomMessageResource("Resource")%>
> <%= cusResource.getMessage("my.label.name")%>
>
> Java code for it looks like:
> import java.util.ResourceBundle;
> ResourceBundle resource = ResourceBundle.getBundle(baseName);
>
>
> So we know that loading properties into resourcebundles and using them as
> shown above works.
>
> My question is..can we do the same for struts2. Can we forcefully load the
> resourcebundles inside java.util.ResourceBundle and then have them be used
> in <s:text> tag?

-- 
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message