What about using Inversion of Control (IoC) to replace the current global context map? The action servlet loads up the IoC factory, initializing all objects, then puts the factory in the request attributes for each request, allowing other components, like taglibs, to be able to access that servlet's objects? Not only would this make managing dependencies much cleaner, but make it easier to extend Struts once class references were changed into interfaces. Of course since any objects that aren't pre-initialized can pull objects from the bean factory in the request, we can ensure that the servlets won't overlap.
The impact to existing Struts can be minimal - we could even put IoC configuration in the jar to prevent any user confusion. For an IoC implementation, I've found Spring (http://www.springframework.org) to be very easy to use and straightforward, not to mention light weight, however it would be pretty easy to provide a few Struts classes to wrap the IoC framework to prevent being tied to one implementation. I'm no Spring expert, but I volunteer to do any work necessary, assuming the idea is approved. Don On Fri, 14 Nov 2003, Ted Husted wrote: > The underlying problem is that Struts stores things directly in the > application and session contexts under static names. So, the resources > (in the generic sense) for one application can overwrite the other. One > reason for modules is to put multiple sets of resources in the shared > contexts under different names. > > An alternate design for the Struts 2.x timeframe might be to gather > everything the framework uses into single context objects, perhaps named > after the servlet. So the "action" servlet would have an "action" > context in the application and session scope, and the "differentAction" > servlet would have it's own "differentAction" context object. Inside of > each context (a Map) would be things like the message resources and > Locale the servlet and client are using. > > Then, when a request is being serviced, a default gateway context can be > placed in the request that would link to the appropriate session and > application contexts for a given controller instance. This is > essentially what the module code does now, but with all the > complications that backward compatibility brings. > > Of course, complications still arise. Such as if the "action" servlet > changes the Locale for a client, is the "differentAction" servlet > suppose to see that change? So, there might still be a global framework > context at the top of the chain, which a controller instance could > update and the other controllers could see. > > Another advantage here is that it would be easier for Struts > applications to pass along its context to a business layer without > binding that layer to HTTP. An Action could pass up the Context chain > without passing the HTTP request itself, or pulling things out piecemeal. > > -Ted. > > [EMAIL PROTECTED] wrote: > > I'm with Edgar on this one - should it not be possible? Of course, I tried the > > following: > > > > <servlet-mapping> > > <servlet-name>action</servlet-name> > > <url-pattern>*.do</url-pattern> > > </servlet-mapping> > > > > <servlet-mapping> > > <servlet-name>differentAction</servlet-name> > > <url-pattern>*.dont</url-pattern> > > </servlet-mapping> > > > > with each mapping to different action servlets with different config files and > > everything got bunged up. It seems like it should have worked but alas. > > > > Perhaps it is a bit of a green question, but why would it not work? > > > > Best, > > > > Alvin > > > > Quoting Edgar P Dollin <[EMAIL PROTECTED]>: > > > > > >>Why wouldn't changing the servlet mapping from *.do --> action servlet to > >>*.[actiontype] --> [associated action servlet] work? As long as you are > >>consistent would struts care? > >> > >>Edgar > >> > >> > >>>-----Original Message----- > >>>From: Ted Husted [mailto:[EMAIL PROTECTED] > >>>Sent: Friday, November 14, 2003 7:10 AM > >>>To: Struts Developers List > >>>Subject: Re: Multi Action servlet ! > >>> > >>> > >>>People have done it, but it's a delicate thing to try. The > >>>recommended > >>>approach is to use Struts 1.1 modules. To customize the front > >>>controller > >>>logic for each module, you can plug in alternate Request > >>>Processors if > >>>needed. This gives you all the benefits of having multiple servlets, > >>>without the extra overhead. (There is *no* performance > >>>benefit in having > >>>multiple servlets that do the same thing.) > >>> > >>>A better place to ask questions like this would be the Struts > >>>USER list. > >>> This is where you'd ask if we were going to support > >>>multiple servlets > >>>in the future. (Answer to that one: not any time soon.) > >>> > >>>-Ted. > >>> > >>>Karikalan Kumaresan wrote: > >>> > >>>>Hi, > >>>> > >>>>Does anyone know, is it possible to have 2 action servlet > >>> > >>>configured > >>> > >>>>in struts for different project in a same JVM/in same webserver. > >>>> > >>>>Cheers, > >>>>Kari... > >>>> > >>>>-----Original Message----- > >>>>From: Steve Raeburn [mailto:[EMAIL PROTECTED] > >>>>Sent: 14 November 2003 07:15 > >>>>To: Struts Developers List > >>>>Subject: RE: Parsing Error in struts > >>>> > >>>> > >>>>Most likely you haven't closed a JSP tag correctly. Try > >>> > >>>commenting out > >>> > >>>>sections of your JSP to narrow down where the error is. > >>>> > >>>>But you should be asking on the struts-user list not here. > >>>> > >>>>Steve > >>>> > >>>> > >>>> > >>>>>-----Original Message----- > >>>>>From: Abhijeet Mahalkar [mailto:[EMAIL PROTECTED] > >>>>>Sent: November 13, 2003 9:21 PM > >>>>>To: Struts Developers List > >>>>>Subject: Parsing Error in struts > >>>>> > >>>>> > >>>>>I am getting following error is there anybody who can guide > >>> > >>>me for he > >>> > >>>>>same.... > >>>>> > >>>>>[11/14/03 10:38:12:954 GMT+05:30] 11d6d752 WebGroup E > >>> > >>>SRVE0026E: > >>> > >>>>>[Servlet Error]-[End of content reached while more parsing > >>>>>required: tag > >>>>>nesting error?]: org.apache.jasper.compiler.ParseException: > >>>>>End of content > >>>>>reached while more parsing required: tag nesting error? > >>>>>at org.apache.jasper.compiler.JspReader.popFile(JspReader.java:293) > >>>>>at org.apache.jasper.compiler.JspReader.hasMoreInput(JspReader.ja > >>>>>va(Compiled > >>>>>Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser.parse(Parser.java(Compiled Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser.parse(Parser.java(Inlined Compiled > >>>>>Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser$Tag.accept(Parser.java(Compi > >>>>>led Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser.parse(Parser.java(Compiled Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser.parse(Parser.java(Inlined Compiled > >>>>>Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser$Tag.accept(Parser.java(Compi > >>>>>led Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser.parse(Parser.java(Compiled Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser.parse(Parser.java(Inlined Compiled > >>>>>Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser$Tag.accept(Parser.java(Compi > >>>>>led Code)) > >>>>>at > >>>>>org.apache.jasper.compiler.Parser.parse(Parser.java(Compiled Code)) > >>>>>at org.apache.jasper.compiler.Parser.parse(Parser.java:1110) > >>>>>at org.apache.jasper.compiler.Parser.parse(Parser.java:1106) > >>>>>at > >>>>>org.apache.jasper.compiler.ParserController.parse(ParserContro > >>>>>ller.java:309) > >>>>>at > >>> > >>>org.apache.jasper.compiler.Compiler.compile(Compiler.java(Compiled > >>> > >>>>>Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.jsp.servlet.JspServlet.loadJSP(JspServ > >>>>>let.java(Compi > >>>>>led Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapp > >>>>>er.loadIfNeces > >>>>>sary(JspServlet.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapp > >>>>>er.service(Jsp > >>>>>Servlet.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile( > >>>>>JspServlet.jav > >>>>>a(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServ > >>>>>let.java(Compi > >>>>>led Code)) > >>>>>at > >>>>>javax.servlet.http.HttpServlet.service(HttpServlet.java(Compil > >>>>>ed Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.StrictServletInstance.doServic > >>>>>e(StrictServle > >>>>>tInstance.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._servic > >>>>>e(StrictLifecy > >>>>>cleServlet.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.IdleServletState.service(Stric > >>>>>tLifecycleServ > >>>>>let.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service > >>>>>(StrictLifecyc > >>>>>leServlet.java(Inlined Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.ServletInstance.service(Servle > >>>>>tInstance.java > >>>>>(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dis > >>>>>patch(ValidSer > >>>>>vletReferenceState.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispa > >>>>>tch(ServletIns > >>>>>tanceReference.java(Inlined Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleW > >>>>>ebAppDispatch( > >>>>>WebAppRequestDispatcher.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatc > >>>>>h(WebAppReques > >>>>>tDispatcher.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward > >>>>>(WebAppRequest > >>>>>Dispatcher.java(Compiled Code)) > >>>>>at > >>>>>org.apache.struts.action.RequestProcessor.doForward(RequestPro > >>>>>cessor.java:10 > >>>>>69) > >>>>>at > >>>>>org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesR > >>>>>equestProcesso > >>>>>r.java:274) > >>>>>at > >>>>>org.apache.struts.action.RequestProcessor.processForwardConfig > >>>>>(RequestProces > >>>>>sor.java:455) > >>>>>at > >>>>>org.apache.struts.tiles.TilesRequestProcessor.processForwardCo > >>>>>nfig(TilesRequ > >>>>>estProcessor.java:320) > >>>>>at > >>>>>org.apache.struts.action.RequestProcessor.process(RequestProce > >>>>>ssor.java:279) > >>>>>at > >>>>>org.apache.struts.action.ActionServlet.process(ActionServlet.j > >>>>>ava:1480) > >>>>>at > >>>>>org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:506) > >>>>>at > >>>>>javax.servlet.http.HttpServlet.service(HttpServlet.java(Compil > >>>>>ed Code)) > >>>>>at > >>>>>javax.servlet.http.HttpServlet.service(HttpServlet.java(Compil > >>>>>ed Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.StrictServletInstance.doServic > >>>>>e(StrictServle > >>>>>tInstance.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._servic > >>>>>e(StrictLifecy > >>>>>cleServlet.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.IdleServletState.service(Stric > >>>>>tLifecycleServ > >>>>>let.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service > >>>>>(StrictLifecyc > >>>>>leServlet.java(Inlined Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.ServletInstance.service(Servle > >>>>>tInstance.java > >>>>>(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dis > >>>>>patch(ValidSer > >>>>>vletReferenceState.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispa > >>>>>tch(ServletIns > >>>>>tanceReference.java(Inlined Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleW > >>>>>ebAppDispatch( > >>>>>WebAppRequestDispatcher.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatc > >>>>>h(WebAppReques > >>>>>tDispatcher.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward > >>>>>(WebAppRequest > >>>>>Dispatcher.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvo > >>>>>ker.java(Compi > >>>>>led Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook > >>>>>(WebAppInvoker > >>>>>.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.hand > >>>>>leInvocation(C > >>>>>achedInvocation.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchBy > >>>>>URI(ServletReq > >>>>>uestProcessor.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.serv > >>>>>ice(OSEListene > >>>>>r.java(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(Http > >>>>>Connection.jav > >>>>>a(Compiled Code)) > >>>>>at > >>>>>com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnec > >>>>>tion.java(Comp > >>>>>iled Code)) > >>>>>at > >>>>>com.ibm.ws.http.HttpConnection.run(HttpConnection.java(Compi > >>> > >>>led Code)) > >>> > >>>>>at > >>>>>com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compil > >>> > >>>ed Code)) > >>> > >>>>> > >>>>>thankx in advace... > >>>>> > >>>>>abhijeet > >>>>> > >>>>> > >>>>> > >>>>>------------------------------------------------------------ > >>> > >>>--------- > >>> > >>>>>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] > >>>> > >>>> > >>> > >>>-- > >>>Ted Husted, > >>> Junit in Action - <http://www.manning.com/massol/>, > >>> Struts in Action - <http://husted.com/struts/book.html>, > >>> JSP Site Design - > >>><http://www.amazon.com/exec/obidos/ISBN=> 1861005512>. > >>> > >>> > >>> > >>> > >>> > >>>--------------------------------------------------------------------- > >>>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] > > > > > > -- > Ted Husted, > Junit in Action - <http://www.manning.com/massol/>, > Struts in Action - <http://husted.com/struts/book.html>, > JSP Site Design - <http://www.amazon.com/exec/obidos/ISBN=1861005512>. > > > > --------------------------------------------------------------------- > 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]