title: java.lang.NumberFormatException - Data Binding errors
body: <p>I am using Spring MVC for a web application and I am working with a simple form that deals with selecting clients and showing contact information. </p>
  
  <p>One of the problems I am having is that If I select a client the first time, it will pull the information up, but the second time it wont. It will show the information from the previous client.</p>
  
  <p>I looked more into what I was logging and I noticed that I was getting a data binding error and was seeing the all too familiar output on my console as the following.</p>
  
  <pre>Failed to convert property value of type [java.lang.String[]] to required type
   [java.lang.Integer] for property 'clientId'; nested exception is
   java.lang.NumberFormatException: For input string: "3349,4182"</pre>
  
  <p>If you see in the error output it shows <pre>...for string: "3349,4182"</pre></p>
  
  <p>For reference the 3349 is the client-ID of the first customer selected, when the form is posted the 4182 is the client-ID of the second.</p>
  
  <p>I have done some research and have come across people who have said that it doing something with treating the two numbers as an array of [3349,4182] as oppose to just taking the new ClientID.</p>
  
  <p>Thanks,</p>
  
  <p><br><br>
  <b>Edit</b>
  The backing object is as follows </p>
  
  <pre>
  public class ClientContactModel implements Serializable {
      private String searchText;
      private Integer clientId;
  public ClientContactModel() {
      }
      public String getSearchText() {
          return searchText;
      }
      public void setSearchText(String searchText) {
          this.searchText = searchText;
      }
      public Integer getClientId() {
          return clientId;
      }
      public void setClientId(Integer clientId) {
          this.clientId = clientId;
      }
  }
  </pre>
  
  <p>The call that is throwing the NumberFormatException is </p>
  
  <pre> clientId = Integer.valueOf(request.getParameter("clientId"));</pre>
  
  <p><br>
  To answer your first question, yes, I am using a SimpleformController</p>
  
  <p>Here is the UI Code pertaining to the client, </p>
  
  <pre><code>&lt;pre&gt;&lt;code&gt;&lt;tr&gt;
    &lt;td align="center"&gt;
      &lt;form:select path="clientId"&gt;
        &lt;form:option value=""&gt;Select a client...&lt;/form:option&gt;
        &lt;form:options items="${clientUsers}" itemValue="id" itemLabel="username" /&gt;
      &lt;/form:select&gt;
      &lt;input type="button" name="selectButton" id="selectButton" value="Go" onclick="selectContact();"&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td align="center"&gt;
      Display clients who have not updated their contact information since
      &lt;input name="month" type="text" id="textfield2" value="MM" size="4"&gt;
      &lt;input name="day" type="text" id="textfield3" value="DD" size="4"&gt;
      &lt;input name="year" type="text" id="textfield4" value="YY" size="4"&gt;
      &lt;input type="submit" name="notUpdatedButton" id="notUpdatedButton" value="Go"&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p></p>
  
  <p>There is a little JS with it too</p>
  
  <pre><code>function selectContact() {
      document.getElementById("searchText").value = "";
      document.getElementById("clientContactObj").submit();
    }
  </code></pre>