struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: checkbox for nested collection
Date Wed, 30 Nov 2005 20:16:15 GMT
Per Jørgen Walstrøm on 30/11/05 17:09, wrote:
> hello, I have the following code in my jsp:
> 
> <nested:iterate id="sectionComponent" property="geSectionComponents">
>  <nested:checkbox property="restrictive"/> </nested:iterate>
> 
> my Collection geSectionComponents contains objects of type
> GeSectionComponent
> 
> GeSectionComponent.java (an auto-generated Hibernate POJO), contains
> the following field (with getter and setter): private Boolean
> restrictive;
> 
> How do I go about to make sure Struts detects when I uncheck a
> checkbox? I am aware of that I should set all corresponding boolean
> properties to false in the reset()-method, but in this case I do not
> have any direct access to those properties.

Hmm. Interesting issue. The first thing to check is what happens to 
struts when you submit a non-boolean value to the nested property. It's 
always a good idea to code defensively, and if that causes an error when 
struts tries to map the http params into your nested bean, then you 
should change it to a string value.

Most properties that are populated direct from the request parameters 
should be type string.

But you said you can't change anything, which is bad. It sounds like a 
quiz question. I wouldn't implement it like this!

You need to do further testing to see what happens when you feed in 
different values that could come from your checkboxes, and that may 
depend on which browser you are using.

HTH
Adam

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


Mime
View raw message