You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Craig R. McClanahan" <cr...@apache.org> on 2001/06/13 22:42:05 UTC

Calling ActionForm.reset() from when creating a bean

Bugzilla #2108 <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2108>
asks a very reasonable question -- whey isn't the reset() method called
when a new form bean is created in the <html:form> tag?  After all, the
controller servlet will always call reset() on the form bean (whether or
not it is newly created) before calling populate() to copy the request
parameters.

This seems like a perfectly reasonable thing to add for 1.1.  My question
is, what do folks think about making this change for 1.0 as well?  I'm
more than a little concerned that it would break existing code, but the
consistency argument might make doing this worthwile anyway.  (Of course,
we would highlight this change in the Release Notes.).

What do you think?  Should we do this in 1.0 as well?

Craig



Re: Calling ActionForm.reset() from when creating a bean

Posted by Roland Huss <Ro...@consol.de>.
"Craig R. McClanahan" <cr...@apache.org> writes:

> Bugzilla #2108 <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2108>
> asks a very reasonable question -- whey isn't the reset() method called
> when a new form bean is created in the <html:form> tag?  After all, the
> controller servlet will always call reset() on the form bean (whether or
> not it is newly created) before calling populate() to copy the request
> parameters.

Recently I would indeed have needed this feature to initialize the
possible choices for multi-choice select box using <html:options>
attribute "property" to return a collection for the multiselect
box. But it since it wasn't called upon form creation, the list has
never been initialized. My solution was to use the "collection"
attribute which takes a collection put into the request by the
previous action, which after all was the cleaner solution anyway (no
logic within forms !). 

> This seems like a perfectly reasonable thing to add for 1.1.  My question
> is, what do folks think about making this change for 1.0 as well?  I'm
> more than a little concerned that it would break existing code, but the
> consistency argument might make doing this worthwile anyway.  (Of course,
> we would highlight this change in the Release Notes.).
> 
> What do you think?  Should we do this in 1.0 as well?

At the moment, I can't imagine any situation where it would harm to
call reset() upond form creation (or why it would be reasonable to
rely that it is *not* called). So, I would vote to include it in
1.0 as well....

cu...
-- 
							...roland huss
						             consol.de

Re: Calling ActionForm.reset() from when creating a bean

Posted by Ted Husted <hu...@apache.org>.
+1 for 1.1

I share your concern about breaking existing code two days before the
release. It won't affect me personally, since I don't link directly to a
JSP, and especially not to a data-entry JSP.

Pending a more convincing argument than simple consistency, I'd be -1 on
1.0, since the easy workaound is to go to an Action first, or get a 1.1
nightly build.

"Craig R. McClanahan" wrote:
> 
> Bugzilla #2108 <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2108>
> asks a very reasonable question -- whey isn't the reset() method called
> when a new form bean is created in the <html:form> tag?  After all, the
> controller servlet will always call reset() on the form bean (whether or
> not it is newly created) before calling populate() to copy the request
> parameters.
> 
> This seems like a perfectly reasonable thing to add for 1.1.  My question
> is, what do folks think about making this change for 1.0 as well?  I'm
> more than a little concerned that it would break existing code, but the
> consistency argument might make doing this worthwile anyway.  (Of course,
> we would highlight this change in the Release Notes.).
> 
> What do you think?  Should we do this in 1.0 as well?
> 
> Craig

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/

Re: Calling ActionForm.reset() from when creating a bean

Posted by Jeff Trent <jt...@structsoft.com>.
Craig,

I'm a strong believer in backward compatibility.  Therefore, my vote is "no"
since it will potentially have potential side affects.

- jeff

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: <st...@jakarta.apache.org>
Sent: Wednesday, June 13, 2001 4:42 PM
Subject: Calling ActionForm.reset() from <html:form> when creating a bean


> Bugzilla #2108 <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2108>
> asks a very reasonable question -- whey isn't the reset() method called
> when a new form bean is created in the <html:form> tag?  After all, the
> controller servlet will always call reset() on the form bean (whether or
> not it is newly created) before calling populate() to copy the request
> parameters.
>
> This seems like a perfectly reasonable thing to add for 1.1.  My question
> is, what do folks think about making this change for 1.0 as well?  I'm
> more than a little concerned that it would break existing code, but the
> consistency argument might make doing this worthwile anyway.  (Of course,
> we would highlight this change in the Release Notes.).
>
> What do you think?  Should we do this in 1.0 as well?
>
> Craig
>
>
>