Why in the example without any annotations the POST handler recieves the populated instance of the form?
How Spring MVC figures it out to make the binding between the model attribute and the parameter in the POST method?
@RequestMapping( value = "/myurl", method = RequestMethod.GET )
public String setView(Model model) {
MyClass instance = new MyClass();
model.addAttribute("viewParameter", instance );
return TEMPLATE_PATH;
}
@RequestMapping( value = "/myurl", method = RequestMethod.POST)
public String handleReqest(MyClass instance, Model model) {
// Why instance is populated out of the box
}