title: How to pass parameters on POST requests on Spring-MVC controller method
body: <p>I am using Spring MVC.</p>
  
  <p>I am sending a POST request from an Ajax context and I sent one parameter. The Content-Type of the request is <code>{'Content-Type':'application/json;'}</code> and in Firefox's Firebug I see the post request is sent with one parameter:</p>
  
  <pre><code>JSON
  orderId "1"
  
  Source
  {"orderId":"1"}
  </code></pre>
  
  <p>How can I get it in my controller in the server? The signature of my method is:</p>
  
  <pre><code>@ResponseBody
  @RequestMapping(value = "/blahblah", method = RequestMethod.POST)
  public void blahblah(@RequestBody(required=false) String orderId ){...
  </code></pre>
  
  <p>The incoming orderId is always null. Any ideas?</p>
  
  <p>Thanks..</p>
  
  <p>UPDATED: I used {'Content-Type':'application/x-www-form-urlencoded;'} and send my parameters in the following format "orderId=" + id . Also, I changed the server method using @RequestParam String orderId and the value is passed. </p>