I have a spring controller defined like this:
@Controller
@RequestMapping("/user")
class UserController {
...
@RequestMapping(method=RequestMethod.POST)
public String save(User user) {
// Do something with user
return "redirect:/...";
}
}
How is post data (data submitted from a form) mapped to the User object in this case? Is there any documentation on how this works?
What happens if I have two POJOs like this?
@Controller
@RequestMapping("/user")
class UserController {
...
@RequestMapping(method=RequestMethod.POST)
public String save(User user, Foo anotherPojo) {
// Do something with user
return "redirect:/...";
}
}