struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <>
Subject Re: Forwarding to action
Date Sun, 23 Jun 2002 14:37:09 GMT
Try it and see =:0)

The only thing to watch for is that the ActionServlet doesn't
distinguish between requests. If you forward to another mapping, the
ActionServlet will run through the usual gauntlet, which includes
calling reset and autopopulating any ActionForm bean. So, if you set a
property on the bean, and try to forward it, the property could get
whacked by the controller. 

In a situation like this, use different beans or add a mutable property
to your bean to tell the other properties to ignore any new input.

An even better approach is to get the business operations out of the
Actions. You can then use the Actions like macros and have them call as
many operations as they need. 

Wanting to chain actions is a warning sign that there is too much
business logic is creeping into the Actions and they are becoming the
API, rather than an adaptor for the API. (Struts should not *be* your
application, it should be a gateway *to* your application.)

-- Ted Husted, Husted dot Com, Fairport NY US
-- Java Web Development with Struts
-- Tel: +1 585 737-3463
-- Web:

"Struts Newsgroup (" wrote:
> Subject: Forwarding to action
> From: "Davor Cengija" <>
>  ===
> [Warning: new Struts user ]
> Is it possible to return a forward to another action (e.g. to chain
> actions)?
> For example:
> <DeleteSomethingAction>
> if (isCanceled(request)) {
>   // now I want to return to ListSomethingAction, and not to
> listSomething.jsp
>   // since ListSomethingAction fills request and does other things
> listSomething.jsp needs
>  // I also need request and probably other Action.execute() parameters
> (mapping and others)
>   return getAction("/something/list").getMapping().findForward("list"); //
> this executes appropriate action and return its "list" forward
> }
> else {
>   // delete
>   return successForward;
> }
> Thanks!
> Davor
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message