title: Getting exception while passing JSON data from JQUERY to java controller
body: <p>I am passing JSON data from jQuery to my Java controller and I am using <code>@RequestBody</code>, but I am getting an exception saying:</p>
  
  <blockquote>
    <p>org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported</p>
  </blockquote>
  
  <p>The data which I am passing is:</p>
  
  <pre><code>myData = {
    "source": "CSS",
    "type": "CSS2",
    "typeValue": "value",
    "textarea_value": " desc"
  }:
  </code></pre>
  
  <p>The AJAX call I am using to pass this data is:</p>
  
  <pre><code>$.ajax({
    url: './common/deleteData',
    type: 'POST',
    data: myData,
    success: function(data) {
      alert("Successfully Deleted Source..");
    },
    error: function(data) {}
  });  
  </code></pre>
  
  <p>My Java Controller is as below</p>
  
  <pre><code>@RequestMapping(value = "/common/deleteData", method = RequestMethod.POST, consumes = {"application/x-www-form-urlencoded; charset=UTF-8"})
  public String deleteData(@RequestBody SourceDelete sourcedelete, final HttpServletRequest request, final RedirectAttributes rdtAttribs) throws ApplicationException 
  {
    LOGGER.entry("Deleting the Merge Preference Details");
    System.out.println(sourcedelete.getSource());
    return null;
  }
  </code></pre>
  
  <p>My POJO object is as below:</p>
  
  <pre><code>public class SourceDelete {
    private String source;
    private String type;
    private String typeValue;
    private String textarea_value;
    //Setters and Getters
  }
  </code></pre>
  
  <p>Can someone please help me figure out why I am getting this error and how I should fix it.</p>