Make sure that your Spring form mentions the modelAttribute="<Model Name"
.
Example:
@Controller
@RequestMapping("/greeting.html")
public class GreetingController {
@ModelAttribute("greeting")
public Greeting getGreetingObject() {
return new Greeting();
}
/**
* GET
*
*
*/
@RequestMapping(method = RequestMethod.GET)
public String handleRequest() {
return "greeting";
}
/**
* POST
*
*
*/
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processSubmit(@ModelAttribute("greeting") Greeting greeting, BindingResult result){
ModelAndView mv = new ModelAndView();
mv.addObject("greeting", greeting);
return mv;
}
}
In your JSP :
<form:form modelAttribute="greeting" method="POST" action="greeting.html">