title: Spring MVC 3 AJAX
body: <p>I'm taking my first steps to explore Spring MVC 3 (annotation driven) and the JSON functionality that it supports.</p>
  
  <p>1) In my JSP page I want to click a link that retrieves JSON</p>
  
  <pre><code>$("a[class=simple2]").click(function() {
        $.getJSON("checkName.html", function(contacts) {
             alert(contacts);
         });
         return false;
  });
  </code></pre>
  
  <p>2) The method that gets called that should return the JSON</p>
  
  <pre><code> @RequestMapping(value = "/checkName")
   public @ResponseBody Contact checkName() {
       List&lt;Contact&gt; contacts = this.userService.retrieveAll();
       return contacts.get(0);
   }
  </code></pre>
  
  <p>When this return gets triggered the DispatcherServlet catches an exception:</p>
  
  <blockquote>
    <p>org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation</p>
  </blockquote>
  
  <p>After searching some I read that the Jackson jar (http://wiki.fasterxml.com/JacksonDownload
   jackson-all-1.6.1.jar) needs to be added to the project (or server? I tried both)</p>
  
  <p>Any ideas? Thanks!</p>