Spring中Model.ModelMap及ModelAndView之间的区别 1. Model(org.springframework.ui.Model)Model是一个接口,包含addAttribute方法,其实现类是ExtendedModelMap.ExtendedModelMap继承了ModelMap类,ModelMap类实现了Map接口. public class ExtendedModelMap extends ModelMap implements Model Model通过以
查看源码可以知道,model中可以存放的数据类型 Model addAttribute(String var1, @Nullable Object var2); Model addAttribute(Object var1); Model addAllAttributes(Collection<?> var1); Model addAllAttributes(Map<String, ?> var1); 引用一下 model是一种概念,而不是一种具体的参数或是其他的具体的体现,MVC
目录 1.Model接口 2.ModelMap 3.ModelAndView 1.Model接口(org.springframework.ui.Model) Model是一个接口,包含addAttribute方法,其实现类是ExtendedModelMap. ExtendedModelMap继承了ModelMap类,ModelMap类实现了Map接口. public class ExtendedModelMap extends ModelMap implements Model Model通过以
一.redirect为什么会丢数据? when a handler method completes, any model data specified in the method is copied into the request as request attributes, and the request is forwarded to the view for rendering. Because it’s the same request that’s handled by both