title: JSON response from Spring Controller not getting resolved
body: <p>I have a similar issue as given <a href="https://stackoverflow.com/questions/3340050/springs-json-not-being-resolved-with-appropriate-response?tab=oldest#tab-top">here</a> . But i cannot solve it with the solutions provided there.</p>
  
  <p>My spring application xml has only mvc annotation driven element.</p>
  
  <pre><code>&lt;mvc:annotation-driven /&gt;
  </code></pre>
  
  <p>The controller code is as given.</p>
  
  <pre><code>@RequestMapping(value = "/search", method = RequestMethod.GET)
  public @ResponseBody
  Book performSearch(@RequestParam("CHARS") String title) {
  return (Book) library.getBook(title);
  }
  </code></pre>
  
  <p>In my javascript I have an jQuery request which tries to get JSON from the url.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  
  function doSearch() {   
      $.getJSON("addBook/search.htm", { CHARS: $('#searchBox').val() }, function(data) 
      {   
          alert("Got Response");
          $('#results').text('');
              for (var index in data) {
                  $('#results').append('&lt;p&gt;' + data[index].title + '&lt;/p&gt;'); 
              }
      });
   }
   &lt;/script&gt;
  </code></pre>
  
  <p>I have a textbox which calls this JS</p>
  
  <pre><code>    &lt;input type="text" id="searchBox" onKeyUp="doSearch();" /&gt;
  
  &lt;div id="results"&gt;Results&lt;/div&gt;
  </code></pre>
  
  <p>While keying in the controller code is called, but the response that comes back has a status code 406 and says Not Acceptable</p>
  
  <p>What could be the problem here? Also can I set the values of "Accept" header to application/json in the jQuery call? If so how?</p>
  
  <p>I am using a locale resolver to resolve the locale. Could this be a problem?</p>
  
  <p>Thanks 
  Dhanush</p>