I'm trying to set up a controller in Spring 3 that will handle AJAX requests from the front end. I had a look at this page which explains it very concisely and simply: http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/
I was able to get the example application working correctly. However, in my own application it's just getting a 404 when I make a request to the url where it should be...
Here's the Java code I have (which right now just takes a String parameter and returns it):
@RequestMapping(value="/test", method=RequestMethod.GET)
public @ResponseBody String test(@RequestParam String teacherId) {
return teacherId;
}
When I try and call this via jQuery's getJSON method, I get a 404.
jQuery.getJSON("test", {teacherId:"123"});
I have the tag in my app-servlet.xml, and Maven is taking in 3 Jackson jars (core, jaxrs, and mapper, all versions 1.8.5) and packaging them in the webapp. The only thing I can think of is maybe Spring Security is not allowing access to this path, but this attribute in the should let already authenticated users have access to this: intercept-url pattern="/**" access="ROLE_USER"
So I'm not sure what I'm missing.