struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Miller" <k...@vardus.co.uk>
Subject Re: checkboxes
Date Mon, 09 Oct 2000 18:10:36 GMT
Colin,

I also submitted a solution that took this approach, and I think someone
else did at about the same time as well (I'm not sure if that was you?). I
think their approach had some benefits over mine - I can't remember off the
top of my head but it might have been something to do with the indexed
properties as you mention
I'm not sure exactly what approach Craig is taking, and perhaps there are
good reasons for it, but I would agree that if the handling can be made
transparent (and I don't see why it shouldn't be able to) then that would be
a *much* nicer solution.

----- Original Message -----
From: "Colin Sampaleanu" <colin@Bspark.com>
To: <struts-dev@jakarta.apache.org>
Sent: Monday, October 09, 2000 6:17 PM
Subject: RE: checkboxes


> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> > Sent: October 9, 2000 11:43 AM
> > To: struts-dev@jakarta.apache.org
> > Subject: Re: checkboxes
> >
> > Chris Miller wrote:
> >
> > > Hi Simon,
> > >
> > > I agree that support for improved checkbox handling needs
> > to be incorporated
> > > into struts. However the approach you have suggested below
> > does have a
> > > flaw - namely that if you try to implement a multi-part
> > form (ie wizard)
> > > using this approach, some extra care is required to ensure
> > that only the
> > > current page's checkboxes are reset.
> > > There have however been several submissions from myself and
> > others that take
> > > a variety of different approaches to the checkbox problem,
> > so hopefully
> > > we'll see something included soon.
> > >
> >
> > The strategy I'm currently testing to deal with this is
> > adding a reset()
> > method
> > to ActionForm, which is called before the bean's properties are
> > populated.  In a
> > simple (single-form) case, you would just reset the boolean
> > representing
> > a
> > checkbox to false, and it will be set to true if included in
> > the request
> > parameters.  For a multi-part form case, the bean will need
> > to be smart
> > and only
> > reset the properties coming from this page -- but reset() will have
> > access to
> > the current request so that it can make this decision.
> >
> > So far, this seems to work pretty well -- look for a checkin
> > this week.
>
> The only problem I have with this is that it requires (essentially
duplicate
> in terms of logic) extra code for every form, as opposed to a generic
> mechanism. I don't know if you saw a suggestion from me (about a month
ago)
> to have processActionForm check for a special parameter containing the
names
> of attributes which should be considered false if missing. I can upload
the
> modification again if needed... The one limitation of that approach is
that
> it didn't deal with indexed properties, but it could be extended.
>
> Colin
>


Mime
View raw message