*Thanks* for posting the code! I meant to look into the link you posted earlier, since I want such a capability, but didn't get to it.. Always knew it would profit to procrastinate..;)
Thanks again, Geeta > -----Original Message----- > From: Doug [mailto:[EMAIL PROTECTED] > Sent: Monday, July 26, 2004 2:48 PM > To: Struts Users Mailing List > Subject: Re: Reloading Application.resources (Again) > > > Well, it does indeed seem to work. The question is whether it leaves > any lingering resources uncollected, but I'm thinking it shouldn't. > Here's my simple Struts Action that takes parameters for > which file to > reload and which resources object to reload: > > public class ReloadMessageResourcesAction extends > org.apache.struts.action.Action > { > public ActionForward execute( > ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response) throws Exception > { > String propertyFileName = > request.getParameter("propertyFileName"); > String messageResourcesKey = > request.getParameter("messageResources"); > > if (messageResourcesKey == null) > messageResourcesKey = Globals.MESSAGES_KEY; > > MessageResourcesFactory factory = > MessageResourcesFactory.createFactory(); > MessageResources resources = > factory.createResources(propertyFileName); > > // Set brand new MessageResources object. There > doesn't appear to > // be any API for clearing out the old one. > ServletContext ctx = getServlet().getServletContext(); > ctx.setAttribute(messageResourcesKey, resources); > return mapping.findForward("next"); > } > } > > Doug wrote: > > > Yes, I know this has been asked before, and I know it's not a base > > capability. However, someone posted this solution several > months ago, > > which seems reasonable to me. Can anyone comment on > whether there's any > > reason not to use this approach? > > > > <http://marc.theaimsgroup.com/?l=struts-user&m=107880611624569&w=2> > > > > <snip> > > MessageResourcesFactory factory = > > MessageResourcesFactory.createFactory(); > > MessageResources resources = > > factoryObject.createResources(nameOfMessage); > > > > ServletContext ctx = getServlet().getServletContext(); > > ctx.setAttribute(Globals.MESSAGES_KEY, resources); > > </snip> > > > > Doug > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]