You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Cooper <ma...@tumbleweed.com> on 2001/02/03 07:07:31 UTC

Re: ActionForward: scope of modifications?

Yes, that is correct. It wouldn't hurt to document it, I guess. As far as
cloning or copying is concerned, is there a real need to do that? I find the
most common pattern that I use for modifying ActionForward's is when I do
something like:

    return new ActionForward(myPath, myRedirect);

Rather than cloning and modifying, I just create a new one with the
parameters I need. Yes, sometimes one or other parameter comes from an
existing ActionForward, but to me that still seems easier than cloning and
modifying.

Hope this helps.

--
Martin Cooper
Tumbleweed Communications

----- Original Message -----
From: "John Raley" <jo...@moonlight.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, January 31, 2001 12:31 PM
Subject: ActionForward: scope of modifications?


> I didn't do a thorough walk through the source, but it appears that if I
> modify an ActionForward returned from an ActionMapping passed to
> Action.perform I am changing global state in struts.  Is this correct?
> If so, I think this should be in the javadoc for ActionMapping, and
> ActionForward should be cloneable or have a copy constructor.
>
> Thanks,
> John
>



Re: ActionForward: scope of modifications?

Posted by John Raley <jo...@moonlight.com>.
Well, in general I'm against making global state modifications easy.  As for
cloning, I'm usually taking an existing ActionForward and adding params to it.
Constructing a new one from an existing one is pretty easy; a clone method
would mostly be a hint not to munge the original!


Martin Cooper wrote:

> Yes, that is correct. It wouldn't hurt to document it, I guess. As far as
> cloning or copying is concerned, is there a real need to do that? I find the
> most common pattern that I use for modifying ActionForward's is when I do
> something like:
>
>     return new ActionForward(myPath, myRedirect);
>
> Rather than cloning and modifying, I just create a new one with the
> parameters I need. Yes, sometimes one or other parameter comes from an
> existing ActionForward, but to me that still seems easier than cloning and
> modifying.
>
> Hope this helps.
>
> --
> Martin Cooper
> Tumbleweed Communications
>
> ----- Original Message -----
> From: "John Raley" <jo...@moonlight.com>
> To: <st...@jakarta.apache.org>
> Sent: Wednesday, January 31, 2001 12:31 PM
> Subject: ActionForward: scope of modifications?
>
> > I didn't do a thorough walk through the source, but it appears that if I
> > modify an ActionForward returned from an ActionMapping passed to
> > Action.perform I am changing global state in struts.  Is this correct?
> > If so, I think this should be in the javadoc for ActionMapping, and
> > ActionForward should be cloneable or have a copy constructor.
> >
> > Thanks,
> > John
> >