title: JSF SelectMany check boxes, binding to sub lists
body: <p>I am using <a href="http://www.primefaces.org/showcase-labs/ui/selectManyCheckbox.jsf" rel="nofollow">SelectMany Checkboxes</a> of primefaces and facing some trouble in storing the values in the Bean.</p>
  
  <p>I need an array of SelectManyCheck boxes. Here is the xhtml so far,</p>
  
  <pre><code>&lt;c:set var="obj" value="#{userBean.userSettingsMap}"&gt; &lt;/c:set&gt;
  &lt;c:forEach items="#{obj}" var="entry"&gt;
    &lt;h:outputText value="#{entry.key} " /&gt;&lt;!--Correctly prints the key --&gt;
    &lt;p:selectManyCheckbox value="#{entry.value}"&gt;&lt;!-- `entry.value` SHOULD correspond to inner lists ---&gt;
      &lt;!-- I want values of these check boxes to be updated in my ManagedBean's property --&gt;
      &lt;f:selectItem itemLabel="Option 1" itemValue="Option 1" /&gt;
      &lt;f:selectItem itemLabel="Option 2" itemValue="Option 2" /&gt;
      &lt;f:selectItem itemLabel="Option 3" itemValue="Option 3" /&gt;
  &lt;/p:selectManyCheckbox&gt;
  &lt;/c:forEach&gt;   
  </code></pre>
  
  <p>The Array of Select Many check boxes is rendered on the page. But when i submit the page, the sub-list is not updated. rather the object in my ManagedBean is not getting updated.</p>
  
  <p>So, on submit i get blank lists displayed on the dialog.</p>
  
  <blockquote>
    <p>{key 1=[], key 2=[]}</p>
  </blockquote>
  
  <p>In my ManagedBean i have,</p>
  
  <pre><code>  private Map&lt;String,List&lt;String&gt;&gt; userSettingsMap; 
  </code></pre>
  
  <p>Where the sub-lists would correspond to the each  <code>&lt;p:selectManyCheckbox&gt;</code> on the view</p>
  
  <p>Submit button is the same as in the examples.</p>
  
  <pre><code>  &lt;p:commandButton value="Submit" update="display" oncomplete="dlg.show()" /&gt;
      &lt;p:dialog header="Selected Values" modal="true" showEffect="fade" hideEffect="fade" widgetVar="dlg"&gt;
  
        &lt;p:outputPanel id="display"&gt;
            &lt;p:dataList value="#{userService.userMaintainceMap}" var="option"&gt;
                #{option}
            &lt;/p:dataList&gt;             
        &lt;/p:outputPanel&gt;
  </code></pre>