title: Multiple select field only posting first selected value in JSP form
body: <p>In a Spring MVC app using JSP, I have a dynamic form generated via JSTL foreach loop that adds a multiple select field to a form with each iteration:</p>
  
  <p>In my JSP file...</p>
  
  <pre><code>&lt;c:forEach items="${myInputList}" var="myInput" varStatus="varstatus"&gt;
  ...
  &lt;select multiple="multiple" name="myInputList[${varstatus.index}].optionList"&gt;
      &lt;option value="First"&gt;First&lt;/option&gt;
      &lt;option value="Second"&gt;Second&lt;/option&gt;
      &lt;option value="Third"&gt;Third&lt;/option&gt;n
  &lt;/select&gt;
  ...
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>In the DTO...</p>
  
  <pre><code>private String[] optionList;
  </code></pre>
  
  <p>When I select "Second" and "Third" and submit the form, the POST only contains...</p>
  
  <pre><code>myInputList[(index value)].optionList=Second
  </code></pre>
  
  <p>The standard advice of postfixing <code>[]</code> to the select name (PHP-style) fails when it hits the controller trying to fill the DTO in; no <code>[]</code> in the name hits the controller without issues, but the only item in the optionList array is the first value as posted.</p>
  
  <p>Also, originally as a non-multiple select input mapped to a basic, non-array String, this control was working fine.  I'm only attempting to update a single select into a multi-select.  </p>
  
  <p>Any advice would be appreciated.  Thanks.</p>