You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Donald Ball <db...@rhoworld.com> on 2003/03/31 20:39:33 UTC
question regarding DynaActionForm.reset()
The API for ActionForm.reset() says it will, "Reset all bean properties
to their default state. This method is called before the properties are
repopulated by the controller servlet." Why then does the default
reset() method for DynaActionForm do nothing? DynaActionForm knows about
its own dynamic properties, it would be easy enough to clear() the map.
Note I'm not complaining, the resulting behavior is actually what I
think I want to have happen, I'm just trying to figure out why it's
designed this way...?
- donald
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: question regarding DynaActionForm.reset()
Posted by Donald Ball <db...@rhoworld.com>.
Craig R. McClanahan wrote:
>>The API for ActionForm.reset() says it will, "Reset all bean properties
>>to their default state. This method is called before the properties are
>>repopulated by the controller servlet." Why then does the default
>>reset() method for DynaActionForm do nothing? DynaActionForm knows about
>>its own dynamic properties, it would be easy enough to clear() the map.
>
> Originally, the reset() method actually did mess with the map, but this
> behavior was inconsistent with the do-nothing behavior of reset() in the
> standard ActionForm class. The bug report related to this was:
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14669
>
> As a result, we removed the previous behavior of reset(), in version 1.7
> of DynaActionForm just before 1.1-beta3 was released.
Thanks, Craig, always willing and ready to step in with a clear and
helpful answer. Unfortunately, I'm still a little bit confused (and I
suspect I'm not entirely alone in that regard).
1. DynaActionForm doesn't clear its bean values on reset() because
ActionForm does not - but DynaActionForm is a concrete implementation,
while ActionForm is abstract, practically speaking if not actually in
the code. You could just as easiy argue that ActionForm does clear its
values on reset() - it just has none to clear!
2. I guess more to the point, why do you call reset() before
manipulating the bean anyway? isn't it better to explicitly keep the old
values around before setting any new ones based on the incoming request?
Finally, any suggestions you have re: my design pattern question on
deriving form beans from underlying model object would be very much
appreciated if you have a minute. Otherwise I'll keep playing around.
- donald
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: question regarding DynaActionForm.reset()
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Mon, 31 Mar 2003, Donald Ball wrote:
> Date: Mon, 31 Mar 2003 13:39:33 -0500
> From: Donald Ball <db...@rhoworld.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: question regarding DynaActionForm.reset()
>
> The API for ActionForm.reset() says it will, "Reset all bean properties
> to their default state. This method is called before the properties are
> repopulated by the controller servlet." Why then does the default
> reset() method for DynaActionForm do nothing? DynaActionForm knows about
> its own dynamic properties, it would be easy enough to clear() the map.
>
> Note I'm not complaining, the resulting behavior is actually what I
> think I want to have happen, I'm just trying to figure out why it's
> designed this way...?
>
Originally, the reset() method actually did mess with the map, but this
behavior was inconsistent with the do-nothing behavior of reset() in the
standard ActionForm class. The bug report related to this was:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14669
As a result, we removed the previous behavior of reset(), in version 1.7
of DynaActionForm just before 1.1-beta3 was released.
> - donald
>
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org