Scott, This is a very interesting question:
I would start off with a new action, e.g., ReloadAction: # # # package com.what.ever.reload; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionServlet; public final class ReloadAction extends Action implements ReloadK { /* reload struts configuration files */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // get handle to ActionServlet ActionServlet servlet = getServlet(); // call init to force re-initialization servlet.init(); // continue (constant is defined in the ReloadK interface) return mapping.findForward(CONTINUE); } } # # # Then map a jsp that calls this action, and just go to that page whenever you'd like to reload the config files. But there's one small caveat here: within the init method for ActionServlet , there are two calls that freeze the ModuleConfig. So if the type of changes you actually want to make on the fly would depend on the configuration having not being frozen, however, then you're probably better off subclassing ActionServlet, and then commenting out these two lines that call the freeze method of ModuleConfig. The snippet where this first occurs is as follows (see the call to freeze at the end): # # # // Initialize modules as needed ModuleConfig moduleConfig = initModuleConfig("", config); initModuleMessageResources(moduleConfig); initModuleDataSources(moduleConfig); initModulePlugIns(moduleConfig); moduleConfig.freeze(); # # # Be sure to change your web.xml to load this new ActionServlet subclass instead (rather than the default). hth - "Scott Purcell" <[EMAIL PROTECTED] To: "Struts Users Mailing List" <user@struts.apache.org> nc.com> cc: (bcc: Jerry Tan/DTCC) Subject: RE: Reloading Configuration File 03/03/2005 01:30 PM Please respond to "Struts Users Mailing List" Thanks for the info Jerry, I get it ... but I am having trouble actually accomplishing this task. Since the ActionServlet is a "javax.http.servlet" I am not sure how to call its its init? The class is "org.apache.struts.action.ActionServlet" but I am uncertain how to init this thing? Anyone have any ideas? Thanks, Scott -----Original Message----- From: Jerry Tan [mailto:[EMAIL PROTECTED] Sent: Thursday, March 03, 2005 12:02 PM To: Struts Users Mailing List Subject: Re: Reloading Configuration File Scott, I haven't looked at that section lately, but I would imagine you can handle this by creating a separate action (e.g., ReloadAction) which just calls the init method of the ActionServlet. Whenever you'd like to reload the config file, then just go to the jsp that you've mapped for ReloadAction, and then that ought to do the trick. hth "Scott Purcell" <[EMAIL PROTECTED] To: <user@struts.apache.org> nc.com> cc: (bcc: Jerry Tan/DTCC) Subject: Reloading Configuration File 03/03/2005 09:30 AM Please respond to "Struts Users Mailing List" Hello, I was reading from my O'Reilly struts book last night, and it has a section on "Reloading The Configuration Files" pp 102. Because I am in development, I am constantly updating the config file and I have to keep stopping and starting my tomcat, I found the section interesting, but it gives no explanation on how to do this. It says one approach is to create a struts action that will reinitialize the ActionServlet? Does this mean I just need to recompile the ActionServlet that came with stuts, or do I need to subclass the ActionServlet and compile that. It looks like once you compile the ActionServlet, that it will reread the config? Does anyone have any knowledge in this area? Thanks, Scott K Purcell | Developer | VERTIS | 555 Washington Ave. 4th Floor | St. Louis, MO 63101 | 314.588.0720 Ext:1320 | [EMAIL PROTECTED] | http://www.vertisinc.com < http://www.vertisinc.com/> Vertis is the premier provider of targeted advertising, media, and marketing services that drive consumers to marketers more effectively. --------------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]