You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ian Hunter <ih...@hunterweb.net> on 2003/03/19 16:11:36 UTC

ForwardAction with redirect

I saw a Bugzilla post from someone who needed to use ForwardAction but get a
redirect rather than a forward, and suggested implementing a
RedirectAction -- did that ever get done?  How are folks handling this
scenario?


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ForwardAction with redirect

Posted by Ian Hunter <ih...@hunterweb.net>.
I had to subclass ForwardAction and force it to redirect.  Here's the code,
for anyone who needs it or cares:

public class RedirectAction extends ForwardAction {

    public ActionForward execute(ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
 throws Exception {
            ActionForward retVal = super.execute (mapping, form, request,
response);
            retVal.setRedirect (true); // there's the key part
            return retVal;
    }


}



----- Original Message -----
From: "Ian Hunter" <ih...@hunterweb.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, March 19, 2003 10:11 AM
Subject: ForwardAction with redirect


> I saw a Bugzilla post from someone who needed to use ForwardAction but get
a
> redirect rather than a forward, and suggested implementing a
> RedirectAction -- did that ever get done?  How are folks handling this
> scenario?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org