title: How to pass multiple checkboxes to the Action
body: <p>I am using Struts 2 and Freemarker. This is my action class:</p>
  <pre><code>package test;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class WelcomeAction {
      
      private String userName;
      private String gender;
      private List&lt;String&gt; fruits;
      private String fruit;
  
  
      public String execute() {
  //      if(!userName.equals(&quot;a&quot;))
  //      {
  //          return &quot;fail&quot;;
  //      }
  //      else {
  //          return &quot;SUCCESS&quot;;           
  //      }
          return &quot;SUCCESS&quot;;
      }   
      
      public String getUserName() {
          return userName;
      }
  
      public void setUserName(String userName) {
          this.userName = userName;
      }
  
      
      public String getGender() {
          return gender;
      }
  
      public void setGender(String gender) {
          this.gender = gender;
      }
  
      public String getFruitsPicked() {
          return fruit;
      }
  
      public void setFruitsPicked(String fruitsPicked) {
          this.fruit = fruitsPicked;
      }
  
      public List&lt;String&gt; getFruits() {
          return fruits;
      }
  
      public void setFruits(List&lt;String&gt; fruits) {
          this.fruits = fruits;
      }
      
      public WelcomeAction(){
          fruits = new ArrayList&lt;String&gt;();
          fruits.add(&quot;apples&quot;);
          fruits.add(&quot;oranges&quot;);
          fruits.add(&quot;pears&quot;);
          fruits.add(&quot;peaches&quot;);
      }
  }
  </code></pre>
  <p>This is what I have in my <code>.ftl</code>:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;input type=&quot;checkbox&quot; list=&quot;fruits&quot; name=&quot;friut[]&quot; value=&quot;apples&quot; /&gt; Apples&lt;br /&gt; 
  &lt;input type=&quot;checkbox&quot; list=&quot;fruits&quot; name=&quot;friut[]&quot; value=&quot;oranges&quot; /&gt; Oranges&lt;br /&gt; 
  &lt;input type=&quot;checkbox&quot; list=&quot;fruits&quot; name=&quot;friut[]&quot; value=&quot;pears&quot; /&gt; Pears&lt;br /&gt; 
  &lt;input type=&quot;checkbox&quot; list=&quot;fruits&quot; name=&quot;friut[]&quot; value=&quot;peaches&quot; /&gt; Peaches&lt;br /&gt;
  </code></pre>
  <p>This is how I tried printing:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;#list fruits as item&gt;${item}&lt;/#list&gt;
  </code></pre>
  <p>But above command prints all the items in my list that I added in my constructor. Of course, I only want the items that were checked when the form was submitted.</p>