Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: ActionForwards from the config file not to be tampered?

Ney André de Mello Zunino

2007-01-09

Replies:

Christopher Schultz escreveu:

> Struts comes with something like this already
> (org.apache.struts.action.ActionRedirect).

Yeah, I did find some references to that class and was looking forward
to using it. Unfortunately, the company I have just joined (and its
home-built framework) relies on an outdated version of Struts.

> The reason that you shouldn't be modifying these objects is that they
> are intended to be created once and used many times. Struts loads its
> configuration into a series of objects in memory and doesn't want you to
> modify that configuration during runtime. If you were to change the
> parameters for a particular ActionForward, then they would be changed
> for every use of that ActionForward thereafter. It would be a mess.
>
> So, the developers chose a solution that would be conservative on memory
> (only one object ever created for an ActionForward in the config file)
> and processor time (don't have to waste time creating and initializing
> those objects). In order to protect from accidental changes, these
> objects are "locked" after they are configured to make sure that folks
> like you don't stumble into a situation where your Struts app starts
> doing seriously unexpected things.

Thank you very much for your detailed explanation and the code. I had
already got things to work using that approach. It's just that I dislike
not understanding the whys of things.

Best regards,

--
Ney Andr?? de Mello Zunino


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.