This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
The ApplicationResources.properties file is read in only once when the ActionServlet initializes and is not reloaded unless the application restarts. If you want to change this behavior, you will have write your own extensions to Struts.
Can you provide me any example how that can be done ? Regards, Ayan Dutta
Joined: Feb 15, 2005
If you want to extend Struts, the first thing you need to do is go to the Struts home page and download the source for the version you're using.
When you look at the source code, you will find that when the Struts ActionServlet initializes, an object of type org.apache.struts.util.MessageResources is created, populated, and placed into Application scope.
One suggestion for making the MessageResources re-loadable would be to copy the logic used to create the resource bundle into a method in a new class, and call the method reloadMessageResources(). You could then call this method whenever you wanted to reload the message resources after you had changed them.
Be aware that if you do this, you are going to face synchronization issues. What's going to happen if one user requests a rebuild of the resource bundle while another user is trying to access it to display a message at the same time? These types of issues are probably why the authors of Struts decided not to make the resource bundle re-loadable.
I'd suggest you take a good look at what you're trying to accomplish by making the resource bundle re-loadable and see if there isn't an easier, less obtrusive way of accomplishing the same thing. [ June 28, 2006: Message edited by: Merrill Higginson ]