struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <>
Subject Re: question regarding DynaActionForm.reset()
Date Mon, 31 Mar 2003 20:36:52 GMT
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:
> 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:
For additional commands, e-mail:

View raw message