struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Römer <torsten.roe...@luniks.net>
Subject Re: Struts2 Dynamic Checkboxes
Date Wed, 30 May 2007 20:55:28 GMT
I think I found an OK solution but one thing does not work and I don't
understand why.

So what I am doing is creating single checkboxes in an iterator,
disabling the automatically generated label through a modified "simple"
theme and creating my custom labels:
										<s:iterator value="cars">
  <s:label>
    <s:checkboxlist templateDir="template"
                    template="checkboxlist.ftl"
                    theme="nolabel"
                    name="car"
                    list="%{''+name}"/>						    <s:text
name="format.moneyround"><s:param value="price"/></s:text>
    <s:property value="name"/>							  </s:label>									</s:iterator>

"cars" is a List of simple beans with, among other, a "name" property.
The "car" property is a Collection. When I check a checkbox and submit
the form, I can see that an XWorkList containing the value is passed to
setCar().
BUT: When the form is redisplayed, as because of a validation error, the
getCar() method is not called and the checkbox is not checked.

Can anyone tell me why?

If I move the <s:checkboxlist> tag outside the <s:iterator>, it works,
but like this I can't create my custom labels, which is what this is all
about...

Torsten

Torsten Römer schrieb:
> Well, why not try both ways... it will be a good exercise no matter what.
> 
> I'll get back when I have some interesting experiences to share with.
> 
> Thanks again!
> 
> Torsten
> 
> Dave Newton schrieb:
>> --- Torsten Römer <torsten.roemer@luniks.net> wrote:
>>> I see there is no point in what I am trying to do.
>> Oh, I don't know about that.
>>
>> You could use a map (or list) for the checkbox values
>> and gather up the result values that way, couldn't
>> you? 
>>
>> You just need to pre-populate the map (or list) in the
>> action before hitting the view.
>>
>> d.
>>
>>
>>
>>        
>> ____________________________________________________________________________________Be
a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers -
Check it out.
>> http://answers.yahoo.com/dir/?link=list&sid=396545469
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

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


Mime
View raw message