struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin Sampaleanu <>
Subject RE: checkboxes
Date Mon, 09 Oct 2000 17:17:37 GMT
> -----Original Message-----
> From: Craig R. McClanahan []
> Sent: October 9, 2000 11:43 AM
> To:
> 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.


View raw message