I have a Facelets page with a <h:dataTable>. In each row there is a <h:selectBooleanCheckbox>. If the checkbox is selected the object behind the corresponding row should be set in the bean.
- How do I do this?
- How to get the selected rows or their data in a backing bean?
- Or would it be better to do it with
<h:selectManyCheckbox>?
One way to send in a parameter via
<h:selectBooleanCheckbox>is to send it in via the title of the Checkbox. In theValueChangeListener, you can get it from the component using agetAttributes().get("title"). This helps in cases where you want to send an id value as a parameter (as opposed to the selected row index).