Selecting several items in a jsp with struts

J

Jim Smith

I have a fairly simple problem which I am having trouble solving using
struts.

The problem.

I have a list of items (a List) which I want to display in a JSP, allow
the user to select some of them and submit the page to produce a report
based on the items selected.

If I was doing this in straight JSP/HTML I would list the items with a
checkbox whose value is the id of the item. This would make an array of
ids available to the back end.

I can't seem to do this with struts. Checkboxes can only have boolean
values, parallel arrays of hidden fields containing the id and a check
boxes don't work because the boolean array only contains those fields
which are checked and which puts it out of synch with the id array.

The only thing I can think of is using javascript to set hidden field
values when the check boxes are clicked, but there ought to be a cleaner
way.

Any suggestions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top