I have a Spring controller which is being called from JQuery.post(). When it is called the controller\'s method is invoked and returns. But then, in the background, Spring c
Solved.
The problem was as #CodeChimp suggested, except I still wanted a void return type.
I added the @ResponseBody
to the addPerson
method and everything worked fine:
@RequestMapping(value="put", method = RequestMethod.POST)
**@ResponseBody**
public void addPerson(@ModelAttribute("person") Person person){
System.out.println(">>>>>>> person: " + person);
System.out.println(">>>>>>>>> " + person.getFirstName());
people.add(person);
}
The clue came from http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-responsebody. Although the documentation is not clear what happens with a void return. Just tried it and it worked.