title: In Spring, how do I bind a list of integers to a RequestParam?
body: <p>I have parameters from the client that are being sent such as</p>
  
  <pre><code>ids[] = 11
  ids[] = 12
  ids[] = 21
  </code></pre>
  
  <p>On the server side, I have a Spring controller with the following method:</p>
  
  <pre><code>@RequestMapping("/delete.x")
  public @ResponseBody Map&lt;String, Object&gt; delete(HttpServletRequest request, @RequestParam("ids[]") List&lt;Integer&gt; ids) {
  </code></pre>
  
  <p>When I try to iterate over the collection of ids as follows:</p>
  
  <pre><code>for (Integer id : ids) {
  </code></pre>
  
  <p>I get an exception as follows:</p>
  
  <pre><code>java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
  </code></pre>
  
  <p>Is Spring changing the type of ids to List&lt;String&gt;? No matter I suppose, how can I avoid this issue and have the ids stored as Integers inside of a List?</p>