I'm taking my first steps to explore Spring MVC 3 (annotation driven) and the JSON functionality that it supports.
1) In my JSP page I want to click a link that retrieves JSON
$("a[class=simple2]").click(function() {
$.getJSON("checkName.html", function(contacts) {
alert(contacts);
});
return false;
});
2) The method that gets called that should return the JSON
@RequestMapping(value = "/checkName")
public @ResponseBody Contact checkName() {
List<Contact> contacts = this.userService.retrieveAll();
return contacts.get(0);
}
When this return gets triggered the DispatcherServlet catches an exception:
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
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)
Any ideas? Thanks!