aspose file tools*
The moose likes JSF and the fly likes Using selectManyCheckbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Using selectManyCheckbox" Watch "Using selectManyCheckbox" New topic
Author

Using selectManyCheckbox

Viswanath Sriram
Greenhorn

Joined: Jul 20, 2006
Posts: 12
I have used datatable tag to display the rows.For every row a check box will appear with its id.Now i want the list of the selected items in the controller.can any body explain this with code.
Sushma Sharma
Ranch Hand

Joined: Jun 02, 2005
Posts: 139
I think you can use your backing beans's property which should be array. but I am not sure how to do that.

the other way round is to iterate through the request parameters and get the value.

e.g.



where
pr:prForm:prTable - pr is subview id, prForm is Form id and prTable is dataTable id.

chk - is id of check box

cnt - is a counter to keep track of the check box number.

I hope that helps.
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
use a dataTable to display your checkbox and other controls.

ie.,


thats all you need. you can be assured that when the action method in your backing bean is called, the "someList" will be populated correctly with what the user has selected.


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using selectManyCheckbox