Skip to main content

Returning ModelAndView

Learn Returning ModelAndView (Model & View, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Returning ModelAndView means the handler gives back one object holding the view and the data; Spring renders that view with that model. Build it : new ModelAndView("view") then addObject("key", value) , and return mav; . Return type of the method is ModelAndView ; the class must be a @Controller , not a @RestController .

More lessons in Model & View