title: Parse input fields as a Array list to controller via @RequestMapping
body: <p>I want to submit all textfields and radiobuttons from my input fields as an ArrayList and parse it to the controller but I don't know really how.</p>
  
  <p>Any help is really appreciated.</p>
  
  <p>Here's what I tried so far:</p>
  
  <pre><code>@RequestMapping(value = "/formdata", method = RequestMethod.POST)
  public String formdata(HttpServletRequest req, @AuthenticationPrincipal User currentUser, 
                         @ModelAttribute RegDatas regDatas, Model model) {
      // get values as regDatas[0]?
  }
  </code></pre>
  
  <p>Here's my HTML form:</p>
  
  <pre><code>&lt;form method="post" th:action="@{/formdata}" th:object="${regDatas}"&gt;
    &lt;div class="col-sm-4"&gt;
      &lt;input th:field="*{regDatas[0].gender}" type="radio" value="MALE" name="gender" disabled="disabled" /&gt;&lt;span&gt;Mr&lt;/span&gt;
      &lt;input th:field="*{regDatas[0].gender}" type="radio" value="FEMALE" name="gender" disabled="disabled"/&gt;&lt;span&gt;Frau&lt;/span&gt;
      &lt;p&gt;Firstname:&lt;/p&gt;
      &lt;input required="required" type="text"  th:field="*{regDatas[0].firstname}" placeholder="Max" disabled="disabled" /&gt;
    &lt;/div&gt;
    &lt;div class="col-sm-4"&gt;
      &lt;input th:field="*{regDatas[1].gender}" type="radio" value="MALE" name="gender" disabled="disabled" /&gt;&lt;span&gt;Mr&lt;/span&gt;
      &lt;input th:field="*{regDatas[1].gender}" type="radio" value="FEMALE" name="gender" disabled="disabled"/&gt;&lt;span&gt;Frau&lt;/span&gt;
      &lt;p&gt;Firstname:&lt;/p&gt;
      &lt;input required="required" type="text"  th:field="*{regDatas[1].firstname}" placeholder="Max" disabled="disabled" /&gt;
      &lt;button type="submit"&gt;Speichern&lt;/button&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My wrapper class:</p>
  
  <pre><code>public class RegDatas {
  
      private List&lt;RegData&gt; regDatas;
  
      public List&lt;RegData&gt; getRegDatas() {
          return regDatas;
      }
  
      public void setRegDatas(List&lt;RegData&gt; regDatas) {
          this.regDatas = regDatas;
      }
  
  }
  </code></pre>
  
  <p>My class to store values:</p>
  
  <pre><code>public class RegData {
  
      private String email;
      private String firstname;
      private Gender gender;
  
      public String getEmail() {return email;}
  
      public void setEmail(String email) {this.email = email;}
  
      public String getFirstname() {return firstname;}
  
      public void setFirstname(String firstname) {this.firstname = firstname;}
  
      public Gender getGender() {return gender;}
  
      public void setGender(Gender gender) {this.gender = gender;}
  }
  </code></pre>
  
  <p>This is the error I see if I run it like this:</p>
  
  <pre><code>org.springframework.beans.NotReadablePropertyException: Invalid property 'RegDatas[0]' of bean class [de.ciss.aag.model.domain.RegData]: Bean property 'RegDatas[0]' is not readable or has an invalid getter method
  </code></pre>