<h:selectBooleanCheckbox doesn't retrieve values on Server
I am using JSF along with RichFaces and Spring Webflow. I am trying to select rows from the data table us开发者_StackOverflowing and perform some operation on the server side on the selected row. How ever I am facing problem retrieving the data from the checkbox.
<rich:column id="compCheckBox" styleClass="center-aligned-text">
<f:facet name="header">
<h:selectBooleanCheckbox title="selectAll">
</h:selectBooleanCheckbox>
<h:outputText value="Select"/>
</f:facet>
<h:selectBooleanCheckbox id="selectComponent" title="selectAll" value="#{workspace.selectedComponentIds[componentInfo.id]}">
</h:selectBooleanCheckbox>
</rich:column>
And submitting the value using
However only the Ids are restored in the Map, and by default all the values of the ids in the map are shown as 'false'.
How do I get the selected checkboxes to get marked as true in the map.
I have referred link text for information.
How can I resolve this?
Thanks, Abdul
You need to ensure that the same datamodel is preserved in the subsequent request. The value
attribtue of the datatable must return exactly the same datamodel during form submit as it was during display. If the datamodel is not present or different, then chances are that the map of selected items won't be filled as you'd expect.
Update as per the comment: you also need to ensure that the table and the submit button are inside the same <h:form>
.
精彩评论