title: ajax call- 406 Not Acceptable
body: <p>I am trying to get JSON response from spring controller by AJAX call in jsp.
  Below is code.</p>
  
  <p>Spring MVC Controller:</p>
  
  <pre><code> @RequestMapping(value = "/data.htm", method = RequestMethod.GET, headers="Accept=*/*",consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
  @ResponseBody
  public TestVO testMe(){
      TestVO testVO = manageService.getData(2);
      return testVO ; //I am getting testVo but after returning from here I am getting 406 Not Acceptable issue
  }
  </code></pre>
  
  <p>Ajax call in JSP:</p>
  
  <pre><code>   $.ajax({
                   url: url2,
                   type: "GET",
                   beforeSend: function(xhr) {
                       xhr.setRequestHeader("Accept", "application/json");
                       xhr.setRequestHeader("Content-Type", "application/json");
                  },
                  success: function(smartphone) {alert("hi");
                  }
     });
  </code></pre>
  
  <p>Please suggest for solution.</p>
  
  <p>Regards</p>