Daniel,
I have only small suggestion for you, because I do not know yet how
struts can help with multiple checkboxes. You can use taglibs/input
library (project Taglibs). It includes Checkbox tag and an example for
multiple checkboxes.
Hope this help.
Maya
Daniel Kern-Ekins wrote:
> I am confused how to architect in struts a form that has
> multiple checkboxes where several can be checked and i need
> to iterate through the results.
>
> problem :
> user has designed form [a table] with several columns that
> identify an item(s) from a datasource and a checkbox column.
>
> when the <xxxAction> receives the <xxxForm>, i need to
> discover, if one or more of the checkbox's were checked,
> iterate through each one checked.
> on each iteration, need to determine which item it belongs
> to and "map" the checkbox checked to the actual data from
> the datasource.
>
> partial solution:
> have iterator produce table.
> create pairs of named checkboxes and named "hidden" input
> fields with the values set to the unique identifier in the
> datasource.
> <%! private int someiterator = 0; %>
> <input type="checkbox" name="cbx<%= someiterator %>"
> value=<struts:htmlProperty name="company"
> property="someId" />>
>
> <input type=hidden
> name="cbxvalue<%= someiterator %>"
> value=<struts:htmlProperty name="dataBean"
> property="dataBeanId" />
> >
>
> but how do i get these values (cbx0, cbx1 and
> cbxvalue0=<blah>, cbxvalue1=<blah>) back into <xxxForm>,
> <xxxAction>?
>
> this seems very un-struts-like. what would be the proper
> solution in struts? i have currently developed in .05
> version.
>
> this looks *very* similar to a december 17 2000, "Checkbox
> Issue" item in the archive but i don't see an answer.
> thanks,
> dan