Hi there, On Tue, Apr 29, 2008 at 3:46 AM, crappycrumpet <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a problem where I have a page (let's call it a.jsp) which calls an > action using <s:action (let's call it actionB in namepaceB) which redirects > to actionA in namespaceA, using redirect-action, which display the name > attribute in object a. (both implements modelDriven). > > actionB take parameter b.id to find the object b. > actionA take parameter a.blahId to find object a. > > so in my struts.xml I have the following setup. > <package name="namespaceA" namespace="/namespaceA"> > <action name="actionA" method="doGetA" class="com.thingybob.AStuff"> > <result>show_name.jsp</result> > </action> > </package> > <package name="namespaceB" namespace="/namespaceB"> > <action name="actionB" method="doGetB" class="com.thingybob.BStuff"> > <result type="redirect-action"> > actionA > namespaceA > b.thingyId > </result> > </action> > </package> > > Now it works fine when I call it by going to the url > http://XXX/namespaceB/actionB.action?b.id=123 but when I call it from a jsp > using <s:action> like below, it would do the method for actionB but not > continue to do actionA. > > <%@ taglib prefix="s" uri="/struts-tags" %> > <s:action name="actionB" namespace="/namespaceB" executeResult="true"> > <s:param name="b.id">123</s:param> > </s:action>
As you might guess, when the JSP rendering is in progress, the HTTP headers are already rendered ("on the net"), so they can't be modified by the server anymore. Thus, an embedded action invoked by <s:action /> cannot send a redirect- or action-redirect-result. Please tell us exactly what you want to do, as there might be a simpler solution to your problem. As your workaround seems to be to "invoke back" actionA from your example, I guess there's another result for actionA which then renders the data which results from actionB into the page. This can either be done using the action chaining (which seems to be discouraged as I've learned from this maling list) where you don't have to invoke the action from the JSP but as a result directly, or simply render the data inside the action tag, doing something like this: | <s:action namespace="/foo" name="bar" executeResult="false"> | <s:property value="myPropertyFromTheBarActionImplementation" /> | </s:action> This works because the action tag does not execute the "usual" action result from the mapping, but rather pushes the action object (and IIRC the model, if you use ModelDriven) onto the stack, and then evaluates the action tag body. Cheers, -Ralf > > Any clue on why it doesn't work and how I can get it to work? > > Thanks! > CC > -- > View this message in context: > http://www.nabble.com/jsp-page-with-s%3Aaction-to-call-an-action-with-a-redirect-action-tp16951812p16951812.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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]