title: How to retrieve checkbox values in Struts 2 action class ?
body: <p>I have dynamic number of checkboxes in jsp page as given below.</p>
  
  <pre><code>&lt;s:iterator value="details"  status="stat"&gt;
           &lt;s:checkbox name="checkbox"  theme="simple" /&gt;
           &lt;s:hidden name="hidden" value="%{top}" /&gt; 
  &lt;/s:iterator&gt;
  </code></pre>
  
  <p>Let's say 4 checkboxes.</p>
  
  <p>and setter in action class is </p>
  
  <pre><code>public void setCheckbox(boolean s[])
  {
      System.out.println(s.length);
  }
  </code></pre>
  
  <p>If I don't select any checkbox, <code>s.length</code> is zero.
  If I select 3rd checkbox, <code>s.lenght</code> is  1 and it is initializing <code>s[0]</code> with <code>true</code>.
  But problem is here how can I find whether 3rd checkbox is selected or another checkbox is selected.</p>
  
  <p>I thought that setter would initialize <code>s[]={false,false,true,false}</code>, if I select third checkbox. But it is initializing <code>s[]={true}</code>.</p>
  
  <p>Corresponding hidden values of those selected boxes are required to perform required action in database. But for that I need to find select checkboxes.<br>
  Please suggest me any solution.</p>