You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Sébastien Migniot <sm...@alphacsp.com> on 2000/12/14 10:03:18 UTC

1)Request includes, 2) ActionForward parameters

Hello all.

  I'm Sébastien Migniot from AlphaCSP France. I'm looking for some features of 
Struts that I can't seem to find :

1) Is there a way to include the response of a component instead of forwarding 
a request to this component ?
    ( I inherited ActionServlet and replaced processActionPerform(...) to make 
the RequestDispatcher.include(request,response) )

2) Is there a way of passing jsp parameters to an Action ?
    ( No solution for the moment neither in the ActionForward class nor in any 
parameter passed up to ActionServlet.processActionPerform(...) )

  Thanks for your response
   ;) Sébastien Migniot

// ----------------------------------------------------------------------------
// - Sébastien Migniot - Développeur AlphaCSP - 
// - http://www.alphacsp.com - smigniot@alphacsp.com -
// "The power resides in the knowledge"
// ----------------------------------------------------------------------------

Re: 1)Request includes, 2) ActionForward parameters

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Sébastien Migniot wrote:

> Hello all.
>
>   I'm Sébastien Migniot from AlphaCSP France. I'm looking for some features of
> Struts that I can't seem to find :
>
> 1) Is there a way to include the response of a component instead of forwarding
> a request to this component ?
>     ( I inherited ActionServlet and replaced processActionPerform(...) to make
> the RequestDispatcher.include(request,response) )
>

Struts assumes that you normally want to forward to a page or servlet that displays
the ultimate result.  Certainly, that page could use <jsp:include>, for example, to
incorporate the results of other components.

An alternative strategy is to have your Action class do the
RequestDispatcher.include() calls itself, and then return null from the perform()
method, instead of an ActionForward.  This return value says "I have already
created the response ... there is nothing else that needs to be done."  However, I
would tend to prefer the strategy described in the previous paragraph.

>
> 2) Is there a way of passing jsp parameters to an Action ?
>     ( No solution for the moment neither in the ActionForward class nor in any
> parameter passed up to ActionServlet.processActionPerform(...) )
>

Are you talking about the passing parameters as *input* to an Action?  Well, it
receives all of the request parameters sent on the original request, combined with
any query parameters on the request URL itself.  The Struts example application
uses this technique, for example, to distinguish whether a create, an edit, or a
delete operation has been requested -- this is defined by including something like
"?action=Edit" at the end of the request path.

The same approach can be used inside the path parameter an ActionForward to pass
unique information.  However, it is more common to use request attributes (which
show up as request scope beans in a JSP page) for this purpose.

>
>   Thanks for your response
>    ;) Sébastien Migniot
>

Craig McClanahan