August 2017
Beginner to intermediate
370 pages
8h 37m
English
ModelAndView is a container object to hold both Model and View. With ModelAndView as a return object, the controller returns the both model and view as a single return value. The model is a map object which makes it possible to store key-value pairs. The following code sample represents the usage of ModelAndView in a Controller:
@Controller @RequestMapping("/account/*") public class UserAccountController { @PostMapping("/signup/process") public ModelAndView processSignup(ModelMap model, @RequestParam("nickname") String nickname, @RequestParam("emailaddress") String emailAddress, @RequestParam("password") String password) { model.addAttribute("login", true); model.addAttribute("nickname", nickname); ...Read now
Unlock full access