Struts: properties in external files, reloading it after changes


Web tier: servlets, JSP, Web frameworks: Struts: properties in external files, reloading it after changes

  1. Hello, I need to have the Property Files outside a Web-Application. This could be stored on an URL or in the File System from the server. The idea is to enable an "easy" update on the Property Files. After an update, the Property Files should be loaded again and show correctly, for example, on some JSP-Page. A possible solution is to have a Timeout. When this time is reached, the Properties will be loaded again. Another possible could be to watch the Directory for changes and react when a changes come. But this is something complicated. I have select the first solution. I have create my own PropertyMessageResources and PropertyMessageResourcesFactory Classes and defined it on the Struts config files. I load the Property Files again when the Timeout is reached. Everything works fine. But after a reload in the JSP-Pages the messages will not be updated. Just when the server goes down and up again. Are the Messages for the JSP-Pages cached somewhere? How can I show the new messages? Please I need help on this issue (or maybe another solution). Best Regards ADS
  2. Struts stores the MessageResource in Request object for each application,what you can try to do is to after timeout re-populate to the request object with new properties read from URL or filesystem- for example: request.getAttribute(Globals.MESSAGES_KEY,MessageResources) You need to take care of locale object if you have different properties for different language.