So i\'m currently taking a course on udemy about Spring MVC. In the current section there\'s a simple form being build to submit firstname and lastname.
Hey user
You are using the wrong annotation. @RequestAttribute is for retrieving attributes set on the HttpServletRequest
using setAttribute
. You however want to bind request parameters to an object, for that you should use the @ModelAttribute annotation instead.
@RequestMapping("/hello")
public ModelAndView helloWorld(@ModelAttribute("info") Information userInfo) { ... }
Changing the annotation will make it work.