Mastering Spring 5.0
上QQ阅读APP看书,第一时间看更新

Flow 4 - Controller redirecting to a View with ModelAndView

In the previous flow, we returned a view name and populated the model with attributes to be used in the view. Spring MVC provides an alternate approach using ModelAndView. The controller method can return a ModelAndView object with the view name and appropriate attributes in the Model. In this flow, we will explore this alternate approach.