Re: Any way to load resources in java.util.ResourceBundle

2010-08-24 Thread akinsgre

OK.. I dropped off this thread because some other fires sprang up at work..
but here I am back where I was a month ago.

struts.xml
constant name=struts.custom.i18n.resources
value=com.fiserv.sourceone.ribs.common.bundles.DbResourceBundle /

index.jsp
s:text name=FS_UI_ACCT_SWITCH_EN_BUTTON_GO_ACCOUNT/ 

The value of name is output on the page, and the DbResourceBundle class
doesn't appear to be loaded.


J_e_f_f wrote:
 
 D'oh! Yeah, that was a typo. Should say struts.xml.
 
 Could you post some relevant code snippets? Also, do you see anything in
 the logs when the application starts up?  
 
 Jeff
 
 
 Greg Akins-2 wrote:
 
 On Fri, Jul 16, 2010 at 9:24 PM, J_e_f_f jam0...@gmail.com wrote:

 If you're specifying your DbResourceBundle class in the web.xml like:
 


 constant name=struts.custom.i18n.resources
 value=com.insomnia.common.bundles.DbResourceBundle /

 
 Was that a typo?  Did you mean struts.xml?  I have it in struts.xml,
 but it doesn't seem to be getting called.  Maybe it should be in
 web.xml .. in that case as an init-param on the Dispatcher filter.
 Right?
 
 -- 
 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-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Re%3A-Any-way-to-load-resources-in-java.util.ResourceBundle-tp29182865p29522847.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Any way to load resources in java.util.ResourceBundle

2010-08-24 Thread Greg Akins
On Tue, Aug 24, 2010 at 10:51 AM, akinsgre angryg...@gmail.com wrote:

 struts.xml
 constant name=struts.custom.i18n.resources
 value=com.fiserv.sourceone.ribs.common.bundles.DbResourceBundle /

 index.jsp
 s:text name=FS_UI_ACCT_SWITCH_EN_BUTTON_GO_ACCOUNT/


A followup to this:

If I put a static initializer with a System.out.println in
DbResourceBundle, it never get's executed; I'm not sure when I should
expect the class to get loaded, but it seems like the constant
declaration isn't doing anything right now.

-- 
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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Any way to load resources in java.util.ResourceBundle

2010-08-24 Thread Dale Newfield

On 8/24/10 12:54 PM, Greg Akins wrote:

On Tue, Aug 24, 2010 at 10:51 AM, akinsgreangryg...@gmail.com  wrote:

struts.xml
constant name=struts.custom.i18n.resources
value=com.fiserv.sourceone.ribs.common.bundles.DbResourceBundle /


That constant has a String value.


index.jsp
s:text name=FS_UI_ACCT_SWITCH_EN_BUTTON_GO_ACCOUNT/


And this is looking up the specified item in 
ApplicationResources.properties




A followup to this:

If I put a static initializer with a System.out.println in
DbResourceBundle, it never get's executed;


Or the output isn't going where you expect it to.

-Dale

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



Re: Any way to load resources in java.util.ResourceBundle

2010-08-24 Thread Greg Akins
On Tue, Aug 24, 2010 at 1:13 PM, Dale Newfield d...@newfield.org wrote:

 struts.xml
 constant name=struts.custom.i18n.resources
 value=com.fiserv.sourceone.ribs.common.bundles.DbResourceBundle /

 That constant has a String value.

From what I've read, the struts.custom.i18n.resources constant usually
gets set to something like global-messages which translates to a
.properties file.  However, at the beginning of this thread I asked
about using ResourceBundle which loads from a database, and this usage
was suggested to me.  I'm not  sure how Struts is reconciling that
constant.. but expected it would either load the class there, or wait
until the first usage.

 index.jsp
 s:text name=FS_UI_ACCT_SWITCH_EN_BUTTON_GO_ACCOUNT/

 And this is looking up the specified item in ApplicationResources.properties

OK, and maybe that's the problem, because I expected it to use the
resource bundle from struts.custom.i18n.resources


 A followup to this:

 If I put a static initializer with a System.out.println in
 DbResourceBundle, it never get's executed;

 Or the output isn't going where you expect it to.


Yeah, maybe.. though if I load that class directly I do see it on my
console (running the app with mvn tomcat:run )



-- 
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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Any way to load resources in java.util.ResourceBundle

2010-08-24 Thread Greg Akins
Yippee!!

After a little more Googling it occurred to me that the default might
be still set in struts.properties; it was.. and when I removed it my
DbResourceBundle started working

Thanks for bearing with me



-- 
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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Any way to load resources in java.util.ResourceBundle

2010-07-19 Thread J_e_f_f

D'oh! Yeah, that was a typo. Should say struts.xml.

Could you post some relevant code snippets? Also, do you see anything in the
logs when the application starts up?  

Jeff


Greg Akins-2 wrote:
 
 On Fri, Jul 16, 2010 at 9:24 PM, J_e_f_f jam0...@gmail.com wrote:

 If you're specifying your DbResourceBundle class in the web.xml like:
 


 constant name=struts.custom.i18n.resources
 value=com.insomnia.common.bundles.DbResourceBundle /

 
 Was that a typo?  Did you mean struts.xml?  I have it in struts.xml,
 but it doesn't seem to be getting called.  Maybe it should be in
 web.xml .. in that case as an init-param on the Dispatcher filter.
 Right?
 
 -- 
 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-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Re%3A-Any-way-to-load-resources-in-java.util.ResourceBundle-tp29182865p29203668.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Greg Akins
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 bhaara...@xwrote:

 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Mike Fotiou
Greg,

  I implemented this by creating my own ResourceBundle implementation 
(DataResourceBundle).  This handles all of the database access and returns 
the appropriate string to Struts by key when asked.

It is enabled by adding the following constant in struts.xml:

constant name=struts.custom.i18n.resources 
value=xxx.utils.content.DataResourceBundle/ 

Finally, in the view, you must wrap an i18n tag for the text-based tags to work 
properly:

@s.i18n name=.utils.content.DataResourceBundle

I'm not sure if this is the best way, but it also allows me to control the 
caching aspect of the bundle, as Struts 2 and even Java will cache a resource 
bundle on their own.  During development, I wanted to be able to reload the 
language tables easily.

Note that for other languages you must make shell bundles like 
DataResourceBundle_fr which simply extends DataResourceBundle and sets the 
getLocale() method appropriately.

Mike

-Original Message-
From: Greg Akins [mailto:angryg...@gmail.com] 
Sent: Friday, July 16, 2010 7:58 AM
To: user@struts.apache.org
Subject: Re: Any way to load resources in java.util.ResourceBundle

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 bhaara...@xwrote:

 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


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



Re: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Greg Akins
Thanks Mike

On Fri, Jul 16, 2010 at 8:21 AM, Mike Fotiou
mike.fot...@tpsgc-pwgsc.gc.ca wrote:
  I implemented this by creating my own ResourceBundle implementation 
 (DataResourceBundle).  This handles all of the database access and returns 
 the appropriate string to Struts by key when asked.


We already have a DataResourceBundle.. and I was hoping I could use
that.  So this is good news.

 Finally, in the view, you must wrap an i18n tag for the text-based tags to 
 work properly:

 @s.i18n name=.utils.content.DataResourceBundle

I'm new to Struts, so this might be a stupid question.. is there
anyway to define that globally?  I'm using SiteMesh, so maybe defining
it in a decorator might be good enough?


 -Original Message-
 From: Greg Akins [mailto:angryg...@gmail.com]
 Sent: Friday, July 16, 2010 7:58 AM
 To: user@struts.apache.org
 Subject: Re: Any way to load resources in java.util.ResourceBundle

 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 bhaara...@xwrote:

 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-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





-- 
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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Mike Fotiou
Yes, kind of.  I'm using Freemarker.  There is a master template that all other 
pages extend, if you will, so the i18n tag encompasses the entire content page 
and only has to be defined once.  Anything included within that tag will use 
the specified resource bundle.

Mike 

-Original Message-
From: Greg Akins [mailto:angryg...@gmail.com] 
Sent: Friday, July 16, 2010 9:34 AM
To: Mike Fotiou
Cc: user@struts.apache.org
Subject: Re: Any way to load resources in java.util.ResourceBundle

Thanks Mike

On Fri, Jul 16, 2010 at 8:21 AM, Mike Fotiou mike.fot...@tpsgc-pwgsc.gc.ca 
wrote:
  I implemented this by creating my own ResourceBundle implementation 
 (DataResourceBundle).  This handles all of the database access and returns 
 the appropriate string to Struts by key when asked.


We already have a DataResourceBundle.. and I was hoping I could use that.  So 
this is good news.

 Finally, in the view, you must wrap an i18n tag for the text-based tags to 
 work properly:

 @s.i18n name=.utils.content.DataResourceBundle

I'm new to Struts, so this might be a stupid question.. is there anyway to 
define that globally?  I'm using SiteMesh, so maybe defining it in a decorator 
might be good enough?


 -Original Message-
 From: Greg Akins [mailto:angryg...@gmail.com]
 Sent: Friday, July 16, 2010 7:58 AM
 To: user@struts.apache.org
 Subject: Re: Any way to load resources in java.util.ResourceBundle

 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 bhaara...@xwrote:

 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-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





--
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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Greg Akins
On Fri, Jul 16, 2010 at 8:21 AM, Mike Fotiou
mike.fot...@tpsgc-pwgsc.gc.ca wrote:
 Finally, in the view, you must wrap an i18n tag for the text-based tags to 
 work properly:

 @s.i18n name=.utils.content.DataResourceBundle

This isn't working for me.

My DbResourceBundle is a class that extends ResourceBundle

I specify it as a constant in struts.xml and then wrap my s:text with
the s:i18n using the fully qualified class

When I load the page I get this logged message WARNING: Could not
find method [getTexts('com.insomnia.common.bundles.DbResourceBundle')]

-- 
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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread J_e_f_f

Greg, 


Greg Akins-2 wrote:
 
 I specify it as a constant in struts.xml and then wrap my s:text with the
 s:i18n using the fully qualified class
 

If you're specifying your DbResourceBundle class in the web.xml like: 

constant name=struts.custom.i18n.resources
value=com.insomnia.common.bundles.DbResourceBundle /

This should make your resource bundle available globally within your S2
application. You shouldn't need to specify it again with the i18n tag. Just
use the s:text tag. 

Jeff
-- 
View this message in context: 
http://old.nabble.com/Re%3A-Any-way-to-load-resources-in-java.util.ResourceBundle-tp29182865p29189230.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Greg Akins
On Fri, Jul 16, 2010 at 9:24 PM, J_e_f_f jam0...@gmail.com wrote:

 If you're specifying your DbResourceBundle class in the web.xml like:

   

 constant name=struts.custom.i18n.resources
 value=com.insomnia.common.bundles.DbResourceBundle /


Was that a typo?  Did you mean struts.xml?  I have it in struts.xml,
but it doesn't seem to be getting called.  Maybe it should be in
web.xml .. in that case as an init-param on the Dispatcher filter.
Right?

-- 
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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Any way to load resources in java.util.ResourceBundle

2010-02-18 Thread roman danilin

Struts2 used com.opensymphony.xwork2.util.LocalizedTextUtil class for
managing Resource Bundles.

Maybe this scenario will help you:
- Create custom ServletContextListener for your webapp;
- Override contextInitialized method like this (change bundle name):

public void contextInitialized(ServletContextEvent event) {
ResourceBundle bundle = ResourceBundle.getBundle(my-own-bundle);
   
LocalizedTextUtil.setDelegatedClassLoader(bundle.getClass().getClassLoader());
LocalizedTextUtil.addDefaultResourceBundle(my-own-bundle);
}


omnipresent wrote:
 
 no help on this one?
 
 On Wed, Jan 27, 2010 at 12:43 PM, Bhaarat Sharma
 bhaara...@gmail.comwrote:
 
 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?


 
 

-- 
View this message in context: 
http://old.nabble.com/Any-way-to-load-resources-in-java.util.ResourceBundle-tp27343882p27642648.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Any way to load resources in java.util.ResourceBundle

2010-01-29 Thread Bhaarat Sharma
no help on this one?

On Wed, Jan 27, 2010 at 12:43 PM, Bhaarat Sharma bhaara...@gmail.comwrote:

 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?