This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Reloading ResourceBundle, MessageResources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Reloading ResourceBundle, MessageResources" Watch "Reloading ResourceBundle, MessageResources" New topic
Author

Reloading ResourceBundle, MessageResources

VijayRawat Rawat
Greenhorn

Joined: Aug 19, 2004
Posts: 9
Hi,
I have a application in struts where if there is change in ResourceBundle properties file, I have to reload it without starting the server.

I have created the Action which is called after there is change in ResourceBundle,
The code is shown below :


But this does not work. Is there a way to reload?
If somebody has sample code, please can you forward
[ July 28, 2006: Message edited by: Merrill Higginson ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I see that you've copied the logic in the ActionServlet's initModuleResources() method. I'm not sure why it doesn't work.

Here's another approach, though:

You do not need to restart the server in order to refresh the message resources file. It is the application that needs to be restarted. Most application servers provide a way to restart an application in batch mode. You may be able to set up some sort of trigger so that if the message properties file is changed, it runs the process to restart the application.


Merrill
Consultant, Sima Solutions
VijayRawat Rawat
Greenhorn

Joined: Aug 19, 2004
Posts: 9
Thanks Merril for your suggestion but I do not need to re-start the application also.
Can you tell me any other way
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm afraid I don't know another way. I'd suggest that you not give up on the code you've started with, though. Since you're copying the same code Struts used to initialize the bundle, I don't see a reason why it shouldn't work. You might try checking the variables at various points to see if they contain the new version of the resource bundle.

If you do get it working, please let us know. There have been questions posed by a number of individuals who also want to refresh the message resource bundle, but none have reported any success.

One more thing: If you post code to the forum, it's much more readable if you enclose it in [ c o d e ] [ / c o d e ] brackets. I've taken the liberty of adding them to your original post.
[ July 28, 2006: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reloading ResourceBundle, MessageResources
 
Similar Threads
Struts --> Plumtree, Portlet ?
ServletContext, again
ServletContext
Get rid of line numbers
JSP error