Code example for ModelAndView

Methods: getModel

0
	} 
	 
	@RequestMapping(value="/createUser", method=RequestMethod.GET)
	public ModelAndView showNewUserForm()
	{ 
		ModelAndView mav = new ModelAndView("newUser");
		User user = new User();
		mav.getModel().put("newUser", user);
		return mav;
	} 
	 
	@RequestMapping(value="/createUser", method=RequestMethod.POST)
	public ModelAndView createUser(@ModelAttribute("newUser") User user)
	{ 
		ModelAndView mav = new ModelAndView("redirect:login");
		this.userService.create(user);
		return mav;
	} 
	/* 
	@RequestMapping(value="/updateUser", method=RequestMethod.GET)