title: Struts2 multi select list: how to get values in action class
body: <p>I am very new to Struts2, struck with multi select tag. I have searched in many places but failed to get the solution. Here is my problem: </p>
  
  <p>In JSP i have used struts2 select tag like this</p>
  
  <pre><code>&lt;s:form action="AjaxSaveSelectedStatus"&gt;
     &lt;s:select label="Select Status" name="masterStatusLists" id="masterStatusLists" 
        list="#{'1':'status1','2':'status2','3':'status3','4':'status4'}" 
        multiple="true" required="true"/&gt;
     &lt;input type="submit" value="Save"/&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p>In struts.xml mapping</p>
  
  <pre><code>&lt;action name="Ajax*" class="com.mypackage.actions.forms.Ajax{1}"&gt;
          &lt;result name="redirect"&gt;${redirectUrl}&lt;/result&gt;
      &lt;/action&gt;
  </code></pre>
  
  <p>In Action class I have used like this</p>
  
  <pre><code>public class AjaxSaveSelectedStatus extends BaseAjaxActionWithSession {
  ArrayList&lt;MasterStatusList&gt; masterStatusLists;
  
  @Override
  public String execute(){
  
      for (MasterStatusList masterStatusList : masterStatusLists) {
          System.out.println(masterStatusList.getStatusId());
      }
      return SUCCESS;
  }
  public ArrayList&lt;MasterStatusList&gt; getMasterStatusLists() {
      return masterStatusLists;
  }
  
  public void setMasterStatusLists(ArrayList&lt;MasterStatusList&gt; masterStatusLists) {
      this.masterStatusLists = masterStatusLists;
  }
  }
  </code></pre>
  
  <p>Here is MasterStatusList Bean class </p>
  
  <pre><code>public class MasterStatusList implements java.io.Serializable {
     private int statusId;
     private String statusName;
     public MasterStatusList() {}
     public int getStatusId() {return this.statusId;}
     public void setStatusId(int statusId) {this.statusId = statusId;}
     public String getStatusName() {return this.statusName;}
     public void setStatusName(String statusName) {this.statusName = statusName;}
  }
  </code></pre>
  
  <p>Now I want to get the list of selected items in client side to the action.</p>