struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignacio de Córdoba <>
Subject s:checkbox inside a s:iterator and values in a Integer[]
Date Sun, 12 Jul 2009 22:16:02 GMT

I've browsed nabble, google, ... but can't find a simple example on how to
do something very simple.

I need to iterate through, let's say, a picture category list, showing each
category as a s:checkbox. The picture belongs to some of these categories
(and user can changed that, or course, thanks to the checkboxes), so some of
the checkboxes must be pre-checked. Which of them are checked is shown in a
Integer[] (could be String[] if necesary, no problem). I guessed the right
way to do it is using a String or Integer array as checked values will be
sent to the struts2 action through that same property.
Is it that difficult to use s:checkbox for this? I know how to do it using
s:checkboxlist but can't here as I need special format in the iteration.

For some reason the following:
<s:iterator value="categoryTree">
<s:checkbox labelposition="right" name="categoryId" fieldValue="%{id}"

(categoryId is a Integer[] having which id values should be checked but all
checkboxes appear as checked)

For some reason I've found more people with this same problem but they got
no answers. Thanks for any example or ideas if I must change the way
pre-checked data is got from the action.
View this message in context:
Sent from the Struts - User mailing list archive at

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

View raw message