title: JSF: How to bind many of h:selectBooleanCheckbox?
body: <p>I have a problem to bind list of h:selectBooleanCheckbox to my bean.
  Anybody helps ?</p>
  
  <p>This is not working:</p>
  
  <pre><code>&lt;ui:repeat value="#{cartBean.productsList}" var="cartProduct" varStatus="i"&gt;
     &lt;h:selectBooleanCheckbox binding="#{cartBean.checkboxes[i.index]}" /&gt;
  &lt;/ui:repeat&gt;
  
  public class CartBean extends BaseBean {
    public List&lt;Product&gt; getProductsList() {...}
  
    private HtmlSelectBooleanCheckbox[] checkboxes;
    public HtmlSelectBooleanCheckbox[] getCheckboxes() {
      return checkboxes;
    }
    public void setCheckboxes(HtmlSelectBooleanCheckbox[] checkboxes) {
      this.checkboxes = checkboxes;
    }
  }
  </code></pre>
  
  <p>I get error:</p>
  
  <pre><code>javax.faces.FacesException: javax.el.PropertyNotFoundException: /WEB-INF/flows/main/cart.xhtml @26,97 binding="#{cartBean.checkboxes[i.index]}": Target Unreachable, 'checkboxes' returned null
  </code></pre>
  
  <hr>
  
  <p>I solved my problem. I used code like below and get what i want (thanks to BalusC blog - <a href="http://balusc.blogspot.com/2006/06/using-datatables.html#SelectMultipleRows" rel="noreferrer">http://balusc.blogspot.com/2006/06/using-datatables.html#SelectMultipleRows</a>):</p>
  
  <pre><code>&lt;ui:repeat value="#{cartBean.productsList}" var="cartProduct" varStatus="i"&gt;
    &lt;h:selectBooleanCheckbox value="#{cartBean.selectedIds[cartProduct.id]}" /&gt;
  &lt;/ui:repeat&gt;
  
  public class CartBean extends BaseBean {
    private Map&lt;Integer, Boolean&gt; selectedIds = new HashMap&lt;Integer, Boolean&gt;();
    public Map&lt;Integer, Boolean&gt; getSelectedIds() {
      return selectedIds;
    }
  }
  </code></pre>