title: Set few checkboxes selected when page loads (jsf)
body: <p>I am creating web application using JSF 2.0 where I want to set checkboxes to be selected when page loads.</p>
  
  <pre><code>&lt;h:selectManyCheckbox value="#{UserRegistration.rightSelected}" id="myRight"&gt;
      &lt;f:selectItem itemValue="add" itemLabel="Add"/&gt;
      &lt;f:selectItem itemValue="delete" itemLabel="Delete" /&gt;
      &lt;f:selectItem itemValue="edit" itemLabel="Edit" /&gt;
  &lt;/h:selectManyCheckbox&gt;    
  </code></pre>
  
  <p>In this case, I want to set, Add and Delete checkbox to be selected by-default. How can I do this?</p>
  
  <p>I tried with,</p>
  
  <pre><code> &lt;body onload="myRight:0:true"&gt;
  </code></pre>
  
  <p>Generate HTML content is</p>
  
  <pre><code>&lt;td&gt;&lt;table id="myRight"&gt;
  &lt;tr&gt;
       &lt;td&gt;
       &lt;input name="myRight" id="myRight:0" value="add" type="checkbox" checked="checked" /&gt;         &lt;label for="myRight:0" class=""&gt; Add&lt;/label&gt;&lt;/td&gt;
       &lt;td&gt;
       &lt;input name="myRight" id="myRight:1" value="delete" type="checkbox" checked="checked" /&gt;&lt;label for="myRight:1" class=""&gt; Delete&lt;/label&gt;&lt;/td&gt;
       &lt;td&gt;
       &lt;input name="myRight" id="myRight:2" value="edit" type="checkbox" checked="checked" /&gt;&lt;label for="myRight:2" class=""&gt; Edit&lt;/label&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>however it is not working.</p>
  
  <p>Please suggest me how to get this done?</p>