struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barett McGavock <bmcgav...@pulvertech.com>
Subject RE: Checkboxes with session-scoped DynaActionForms
Date Wed, 17 Dec 2003 20:13:00 GMT
If your fields are currently Strings, just put
field = new String[0];
in your reset() method. You don't need to change it to a [Bb]oolean.

This advice should work for any type.

B

-----Original Message-----
From: Sgarlata Matt [mailto:sgarlata_matt@bah.com] 
Sent: Wednesday, December 17, 2003 12:48 PM
To: Struts Users Mailing List
Subject: Checkboxes with session-scoped DynaActionForms


Does anyone know a good reference on how to use checkboxes with
session-scoped DynaActionForms?  The problem I am running into is that when
the form bean is session scoped, the checkbox "sticks" to always being
checked even if the user unchecks the checkbox.  This makes some sense to
me, because I know that if the checkbox is unchecked then a value for the
checkbox is not passed along in the request, so the old value is kept.  I
think with ActionForms this is solved by making the underlying property of
the checkbox of type boolean and by setting the value of the checkbox to
false in the reset() method of the ActionForm.  So, what is the correct
setup with DynaActionForms?  Should I make my underlying form property of
type java.lang.Boolean?  Also, It looks like I am going to have to subclass
DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in
the reset() method of the form bean.  That seems like quite a pain (kind of
defeats the purpose of Dyna forms, doesn't it?).  Is that correct?

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message