RE: Why do we need SwitchAction
Yes. In a follow-up e-mail I asked a follow-up question. This problem also exists if contextRelative forwards are used. Shouldn't the contextRealtive forward change the module before forwarding the request. Sanjay -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 4:03 PM To: Struts Users Mailing List Subject: Re: Why do we need SwitchAction Doing things your way leaves the wrong ModuleConfig stored under the request attribute identified by Globals.MODULE_KEY, so the destination action or page will likely misbehave. You can avoid using SwitchAction, as long as you emulate what it accomplishes -- a call to RequestUtils.selectModule() for the new prefix. Craig On Thu, 30 Jan 2003, Sharma, Sanjay (LNG-DAY) wrote: > Date: Thu, 30 Jan 2003 13:18:23 -0500 > From: "Sharma, Sanjay (LNG-DAY)" <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: Struts Users Mailing List <[EMAIL PROTECTED]> > Subject: Why do we need SwitchAction > > > I am wondering why SwicthAction is needed. > > The following example uses SwitchAction to switch from module test2 to > module test. > > In config file of module test2. > ... > > type="org.apache.struts.actions.SwitchAction"/> > ... > > ... > > To forward to Action test in module test from an Action in current module > (test2), I can use > > return (new > ActionForward("/toModule.do?prefix=/test&page=/test.do")); > > But I can accomplish the same thing by doing > > ActionForward af = new ActionForward("/test/test.do"); > af.setContextRelative(true); > return af; > > So why do we need SwitchAction > > Sanjay > > > > - > 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]
Re: Why do we need SwitchAction
Doing things your way leaves the wrong ModuleConfig stored under the request attribute identified by Globals.MODULE_KEY, so the destination action or page will likely misbehave. You can avoid using SwitchAction, as long as you emulate what it accomplishes -- a call to RequestUtils.selectModule() for the new prefix. Craig On Thu, 30 Jan 2003, Sharma, Sanjay (LNG-DAY) wrote: > Date: Thu, 30 Jan 2003 13:18:23 -0500 > From: "Sharma, Sanjay (LNG-DAY)" <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: Struts Users Mailing List <[EMAIL PROTECTED]> > Subject: Why do we need SwitchAction > > > I am wondering why SwicthAction is needed. > > The following example uses SwitchAction to switch from module test2 to > module test. > > In config file of module test2. > ... > > type="org.apache.struts.actions.SwitchAction"/> > ... > > ... > > To forward to Action test in module test from an Action in current module > (test2), I can use > > return (new > ActionForward("/toModule.do?prefix=/test&page=/test.do")); > > But I can accomplish the same thing by doing > > ActionForward af = new ActionForward("/test/test.do"); > af.setContextRelative(true); > return af; > > So why do we need SwitchAction > > Sanjay > > > > - > 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]
RE: Why do we need SwitchAction
May be I understand why SwicthAction is needed. If I want to forward from an Action in module A to a JSP in module B, I can set the contextRelative to true. ... However when I get to JSP in moduleB, I am still really in module A (Module A is the current module on the request). All URLs I build using the tag will prepend moduleA even though the JSP is in module B. Does this mean that I can never forward to a JSP in another module directly and I should use SwitchAction as an intermediate forward. Seems like too much work just to forward to a JSP. Also this makes contextRelative forwards useless in most cases. Sanjay -Original Message- From: Sharma, Sanjay (LNG-DAY) [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 1:18 PM To: Struts Users Mailing List Subject: Why do we need SwitchAction I am wondering why SwicthAction is needed. The following example uses SwitchAction to switch from module test2 to module test. In config file of module test2. ... ... ... To forward to Action test in module test from an Action in current module (test2), I can use return (new ActionForward("/toModule.do?prefix=/test&page=/test.do")); But I can accomplish the same thing by doing ActionForward af = new ActionForward("/test/test.do"); af.setContextRelative(true); return af; So why do we need SwitchAction Sanjay - 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]
Why do we need SwitchAction
I am wondering why SwicthAction is needed. The following example uses SwitchAction to switch from module test2 to module test. In config file of module test2. ... ... ... To forward to Action test in module test from an Action in current module (test2), I can use return (new ActionForward("/toModule.do?prefix=/test&page=/test.do")); But I can accomplish the same thing by doing ActionForward af = new ActionForward("/test/test.do"); af.setContextRelative(true); return af; So why do we need SwitchAction Sanjay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]