title: Sending array of entities as parameters in Struts2
body: <p>For example I need to save several employees from form:</p>
  
  <pre><code>&lt;h4&gt;Employee 1&lt;/h4&gt;
  &lt;div&gt;
  &lt;input type="text" name="names"&gt;
  &lt;input type="text" name="ages"&gt;
  &lt;input type="text" name="salaries"&gt;
  &lt;/div&gt;
  
  &lt;h4&gt;Employee 2&lt;/h4&gt;
  &lt;div&gt;
  &lt;input type="text" name="names"&gt;
  &lt;input type="text" name="ages"&gt;
  &lt;input type="text" name="salaries"&gt;
  &lt;/div&gt;
  
  &lt;h4&gt;Employee 3&lt;/h4&gt;
  &lt;div&gt;
  &lt;input type="text" name="names"&gt;
  &lt;input type="text" name="ages"&gt;
  &lt;input type="text" name="salaries"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>for that I do this:</p>
  
  <pre><code>public EmployeeAction extends ActionSupport {
  
    private String[] employeesNames;
    private Integer[] employeesAges;
    private Integer[] employeesSalaries;
  
    // Setters and getters
  
    public String save() {
      Employee[] employees = new Employee[size];
      // Creating employee objects with names, ages and salaries
      // and then save
      saveBatch(employees);
      return SUCCESS;
    }
  
  }
  </code></pre>
  
  <p>Is there a way when I can save data from form without processing of arrays,
  but merely to save array of employees?
  For instance:</p>
  
  <pre><code>&lt;h4&gt;Employee 1&lt;/h4&gt;
  &lt;div&gt;
  &lt;input type="text" name="employees.name"&gt;
  &lt;input type="text" name="employees.age"&gt;
  &lt;input type="text" name="employees.salary"&gt;
  &lt;/div&gt;
  
  &lt;h4&gt;Employee 2&lt;/h4&gt;
  &lt;div&gt;
  &lt;input type="text" name="employees.name"&gt;
  &lt;input type="text" name="employees.age"&gt;
  &lt;input type="text" name="employees.salary"&gt;
  &lt;/div&gt;
  
  &lt;h4&gt;Employee 3&lt;/h4&gt;
  &lt;div&gt;
  &lt;input type="text" name="employees.name"&gt;
  &lt;input type="text" name="employees.age"&gt;
  &lt;input type="text" name="employees.salary"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and action class:</p>
  
  <pre><code>public EmployeeAction extends ActionSupport {
  
    private Employee[] employees;
  
    // Setters and getters
  
    public String save() {
      saveBatch(employees);
      return SUCCESS;
    }
  
  }
  </code></pre>