Very true. We agree Craig, but why should the moduleConfig be frozen, there 
could have been a provision made for adding an action mapping dynamically, that could 
determine its config at runtime. A situation follows:

        Maybe what I'm talking is really bad design but please enlighten me, we had 
(have!) a situation wherein, a user has a multistep procedure and can navigate to any 
previous step through links, however the form in the current JSP needs to retain its 
values and needs to be validated, therefore he is allowed to goto a previous step only 
after his current input is validated which would happen only after his values are 
saved in the form by Struts. 

        However this needs to be done only if the form has changed as validating every 
field wud be unnecessary otherwise. 
So we have a saveAndForward Action which is always the target of a link/form submit. 
In addition to the form parameters it receives a dirty flag (which says if the user 
updated the form), a param saying where to go and a param saying to which form I ought 
to submit this. Depending on the value of the forward I either forward it to an action 
mapping or to the JSP requested. 
        Now all that action class does is a forward to the JSP and has no business 
logic. So we just needed a dispatch action which could take its "parameter" at 
runtime, and be associated with an action form and input at runtime. How would you 
solve this situation? We are still thinking about adding an unfrozen action mapping to 
the existing modules by overloading the initModules. 

:)

-----Original Message-----
From: Craig McClanahan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 27, 2004 10:54 PM
To: Struts Users Mailing List
Subject: Re: mapping.setInput()


On Tue, 27 Jul 2004 11:34:48 +0530, Raghuram Kanadam
<[EMAIL PROTECTED]> wrote:
> Sory Satish! Configurations freeze upon loading! Check the ActionServlet's code. 
> However We did find a way through, If you dont specify the input parameter then the 
> ActionConfig.getInput () returns a new ForwardConfig (Unfrozen)!! Use this. But I 
> would not beleive this is good design, for that was not the intent. You could 
> override the initModuleConfigMethods () to create a new Actionmapping of you own for 
> the purpose but...!
> 
> :)

Note that there is a very good reason the configuration objects are
frozen ... they are shared by all users.  If you were allowed to
change, say, a ForwardConfig (as is being proposed here) on the fly,
you would be affecting *all* users of your application that are using
that particuar forward at the same time, not just one user.

Creating a new ForwardConfig object is the way to go for this
particular need ... just be aware that, the more you do this sort of
thing, the more knowledge about the overall organization of your
application is being spread around your Actions, instead of being
centraized in the struts-config.xml file.  You might want to at least
add some comments to struts-config.xml to point your future developers
back at the actions that are affected if you ever decide to change the
organization of forwards in the future -- Murphy's Law guarantees, of
course, that you'll pick ones like this and cause bugs :-).

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to