title: Index of out of bounds while assigning property .?
body: <p>I have below FieldValue modal class, with textValues property of ArrayList of String.</p>
  
  <pre><code>@Entity
  @Table(name = "TBL_STD_FIELD_VALUE")
  public class FieldValue implements Serializable {
  
  @Id
  @GeneratedValue
  @Column(name = "FLD_VERSION")
  private int version;
  
  @Column(name = "FLD_VALUE")
  private ArrayList&lt;String&gt; textValues;
  
    public ArrayList&lt;String&gt; getTextValues() {
      if(this.textValues == null){
          return new ArrayList&lt;String&gt;();
      }
     return textValues;
    }
  }
  </code></pre>
  
  <p>and Below is addForm.jsp . I am assigning that textValues list to input fields as shown in below code.</p>
  
  <pre><code>&lt;form:form name="moduleForm" modelAttribute="fieldValue"  id="moduleForm"   action="/module/saveAddForm.htm" method="POST" onsubmit="return validateMandetoryFields();"&gt;
      &lt;table width="100%" id="preferenceTable" style="border: 0px solid #ccc;"&gt;
          &lt;c:forEach items="${fields}" var="field" varStatus="no"&gt;
              &lt;tr height="30px"  bordercolor="#FFF" style="cursor: pointer;" title="Module Name"&gt;
                  &lt;td width="60%" align="left"&gt;
                      &lt;form:input type="${field.type}" style="width: 250px;" path="textValues[${no.index}]"   title="Name of the Module" /&gt;  
                  &lt;/td&gt;
           &lt;/tr&gt;
        &lt;/c:forEach&gt;
  </code></pre>
  
  <p></p>
  
  <p>Belos is code from controller, I am using MultiActionController.</p>
  
  <pre><code>public ModelAndView addForm(HttpServletRequest request,HttpServletResponse response) {
      String moduleId = request.getParameter("moduleId");
  
      Module module = moduleDao.get(Module.class,Long.parseLong(moduleId));
      List&lt;Fields&gt; fields = fieldDao.getAllFields(Long.parseLong(moduleId));
  
      ModelAndView model = new  ModelAndView("admin/module/addForm");
      model.addObject("fields",fields);
      model.addObject("fieldValue",fieldValue);
  
      return model;
  } 
  </code></pre>
  
  <p>It is giving me below error message.</p>
  
  <pre><code>org.springframework.beans.InvalidPropertyException: Invalid property 'textValues[0]' of bean class [com.cloudcodes.gdirectory.model.module.FieldValue]: Index of out of bounds in property path 'textValues[0]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
  </code></pre>
  
  <p>Please guide me to resolve this issues.</p>