Problem with ModelAndView and ModelMap in AnnotationController, Springframework <p>I have a question that is a point difference between ModelAndView and ModelMap.</p> <p>I want to maintain modelAndView when requestMethod is "GET" and requestMethod is "POST". My modelAndView saved others.</p> <p>So I made modelAndView return type to "GET", "POST" methods.</p> <p>But, Request lost commandObject, form:errors..., if request return showForm on "POST" because request validation failed.</p> <p>example)</p> <pre><code>private ModelAndView modelAndView; public ControllerTest{ this.modelAndView = new ModelAndView(); } @RequestMapping(method = RequestMethod.GET) public ModelAndView showForm(ModelMap model) { EntityObject entityObject = new EntityObject(); CommandObject commandObject = new CommandObject(); commandObject.setEntityObject(entityObject); model.addAttribute("commandObject", commandObject); this.modelAndView.addObject("id", "GET"); this.modelAndView.setViewName("registerForm"); return this.modelAndView; } @RequestMapping(method = RequestMethod.POST) public ModelAndView submit(@ModelAttribute("commandObject") CommandObject commandObject, BindingResult result, SessionStatus status) { this.commandValidator.validate(commandObject, result); if (result.hasErrors()) { this.modelAndView.addObject("id", "POST"); this.modelAndView.setViewName("registerForm"); return this.modelAndView; } else { this.modelAndView.addObject("id", "after POST"); this.modelAndView.setViewName("success"); } status.setComplete(); return this.modelAndView; } </code></pre>