title: Spring MVC - HTTP status code 400 (Bad Request) for missing field which is defined as being not required
body: <p>I have Spring MVC application with this controller method.</p>
  
  <pre><code>@RequestMapping(value = "/add", method = RequestMethod.POST)
  public String addNumber(@RequestParam(value="number", required=false) Long number) {
     ...
     return "redirect:/showAll/";
  }
  </code></pre>
  
  <p>In my JSP I have a standard HTML form which is posting a value named "number" to the controller method above. However, if I leave out the value (do not enter anything into the text field) and POST the data to the controller, before the controller method is called my browser shows</p>
  
  <pre><code>HTTP Status 400 - Required Long parameter 'number' is not present
  </code></pre>
  
  <p>although the controller method annotation clearly defines the "number"-parameter as <strong>not</strong> required.</p>
  
  <p>Does anyone have a slight idea of what could be going on?</p>
  
  <p>Thank you.</p>
  
  <p>PS: The exception that is being thrown is as follows:</p>
  
  <pre><code>org.springframework.web.bind.MissingServletRequestParameterException: Required Long parameter 'number' is not present
  </code></pre>
  
  <p><strong>EDIT: This is a Spring 3.2.3.RELEASE bug ( <a href="https://jira.springsource.org/browse/SPR-10592" rel="noreferrer">see here</a>). With version 3.1.4.RELEASE I do not have this problem anymore.</strong></p>