title: selecting multiple values from p:datatable via a checkbox and sending it to bean
body: <p>I am following this link <a href="http://balusc.blogspot.com/2006/06/using-datatables.html" rel="nofollow">http://balusc.blogspot.com/2006/06/using-datatables.html</a> for selecting multiple checkboxes and retrieving the value in the bean:</p>
  
  <p>My jsf code is below:</p>
  
  <pre><code>&lt;p:dataTable value="#{deviceController.devicesModel}"
              var="item" widgetVar="deviceTable"
              selection="#{deviceController.selectedDevices}"
              rowKey='#{item}'&gt;
      &lt;p:column  sortBy="#{item.manufacturerSerialNum}" filterBy="#{item.manufacturerSerialNum}"&gt;
          &lt;f:facet name="header"&gt;
              &lt;h:outputText value="Manufacturer Serial No"/&gt;
          &lt;/f:facet&gt;
          &lt;h:outputText value="#{item.manufacturerSerialNum}" /&gt;  
      &lt;/p:column&gt;             
      &lt;p:column selectionMode="multiple"&gt;
          &lt;f:facet name="header"&gt;
              &lt;h:outputText value="#{bundle.ListLaptopTitle_inService}"/&gt;
          &lt;/f:facet&gt;
          &lt;h:selectBooleanCheckbox value="#{item.isInService}"/&gt;
      &lt;/p:column&gt;
  &lt;/p:dataTable&gt; 
  
  &lt;p:commandButton action="#{deviceController.getSelectedItems}" 
          value="Submit Request" style="margin-top: 20px"/&gt;
  </code></pre>
  
  <p>My bean code is:</p>
  
  <pre><code>public String getSelectedItems(){
          selectedDevicesList = new ArrayList&lt;Device&gt;();
          List&lt;Device&gt; dev=createDeviceList();
          for (Device item :dev ) {
              if (item.getIsInService()) {
                  selectedDevicesList.add(item);
                  item.setIsInService(false); // Reset.
              }
      }
          return "selected";
      }
  </code></pre>
  
  <p>What I am not understanding is where are we passing the values of selected rows from the table. Initially, if I have 4 rows and all the check boxes are unchecked now when i check two rows then it should go to the bean and these two values should be updated in database. Like I should get the values of the <code>inservice</code> field for these two beans as true in my bean.Could you let me know what I am missing.Thanks.</p>