You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bob McCune <bm...@frontiernet.net> on 2003/07/04 08:02:57 UTC

Newbie: Forwarding question

I've just started working with Struts and am having some difficulty
understanding the practical difference between an ActionForward and a
ForwardAction.  If I am simply creating links between JSP's is there any
difference between using a global ActionForward versus using an action
instance of type ForwardAction?
 
TIA

RE: Newbie: Forwarding question

Posted by Steve Raeburn <st...@ninsky.com>.
An ActionFoward represents information about a web destination (such as its
URL).

Actions return ActionForwards from their execute() method telling the
ActionServlet where to forward control.

A ForwardAction is a specialised Action that creates and returns an a
ActionForward based on a parameter (path) you configure.

One way of forwarding to another JSP uses the ForwardAction:

  <action-mappings>
    <action path="/myAction"
            type="org.apache.struts.actions.ForwardAction"
		parameter="/jsp/welcome.jsp">
    </action>
  </action-mappings>

The ForwardAction does not require you to configure an ActionForward, it
dynamically creates one from the parameter you supply.
You can only use the ForwardAction to forward to a URI within your web
application.

Steve


> -----Original Message-----
> From: Bob McCune [mailto:bmccune@frontiernet.net]
> Sent: July 3, 2003 11:03 PM
> To: Struts Users Mailing List
> Subject: Newbie: Forwarding question
>
>
> I've just started working with Struts and am having some difficulty
> understanding the practical difference between an ActionForward and a
> ForwardAction.  If I am simply creating links between JSP's is there any
> difference between using a global ActionForward versus using an action
> instance of type ForwardAction?
>
> TIA
>



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