springMVC Model ModelMap 和 ModelAndView的区别

简单来说:

Model是包含四个addAttribute 和一个  merAttribute方法的接口。

ModelMap :实现了Map接口,包含Map方法。视图层通过request找到ModelMap中的数据。

ModelAndView:是包含ModelMap 和视图对象的容器。正如名字暗示的一样既包含模型也包含视图,而ModelMap只是包含模型的信息。

ModelAndView的例子,台后

ModelAndView的例子,前台view

 

posted @ 2017-07-21 16:31  每一天,为明天  阅读(310)  评论(0编辑  收藏  举报