You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Griffith, Michael *" <Mi...@fda.hhs.gov> on 2008/07/16 20:23:27 UTC

and redirect problem

Hello All, 

 

I have a JSP that includes a struts action as such:  

 

]--- begin edit.jsp ---[

 

<%@ include file="../fragments/taglibs.jsp"%>

<link rel="stylesheet" href="../css/datacall.css" type="text/css">

<s:action name="form" executeResult="true" flush="false"
ignoreContextParams="false"/>

 

]--- end edit.jsp ---[

 

This JSP is a tile, (using Tiles 2) and the action form maps to an
action like this:

...

<action name="form" class="....web.struts.action.ResponseForm">

            <result name="success" type="responseResult">

                <param name="exposedValue">document</param>

                <param
name="stylesheetLocation">/WEB-INF/xsl/question.xsl</param>

            </result>

            <result name="finish" type="redirect-action">

            <param name="actionName">list</param>

                        <param name="namespace">/respond</param>

            </result>

             <!-This works, where as redirect-action does not. 

             <result name="finish" type="chain">

                        <param name="actionName">list</param>

                        <param name="namespace">/respond</param>

             </result> 

-->

</action>

 

The reason this is setup this way is that the form action renders an
html fragment, using XML/XSL result type, but it is nested inside of a
tiled result.  The form basically is like a questionnaire wizard, that
presents an ordered list of questions and allows a user to answer them,
moving forward and back in the sequence.  In my ResponseForm action
class I look for a parameter passed via the http post, and if the
parameter is "Quit" or "Finish" I want to execute my finish result, and
redirect to the list where I started.  

 

ResponseForm.execute

...

} else if (method != null && (method.equalsIgnoreCase("Quit") ||
method.equalsIgnoreCase("Finish"))) {

return "finish";

}

...

 

This does not work - and it doesn't throw any exceptions.  If I try to
use the result type chain instead of redirect-action, I am directed back
to the list, but the entire action (including the outermost tiles) show
up in the body tile - so it's like the website shows an entire HTML
response in the body tile, which is not correct either.

 

Any insight as to how to overcome this would be much appreciated...

 

Best regards,

Michael Griffith