struts-user mailing list archives

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

Hello,
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}"
label="%{name}"/>
</s:iterator>

(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.
Ignacio
-- 
View this message in context: http://www.nabble.com/s%3Acheckbox-inside-a-s%3Aiterator-and-values-in-a-Integer---tp24452969p24452969.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message