struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Römer <>
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:checkboxlist templateDir="template"
                    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
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


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 <> 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.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message