+-

之间有什么区别
model.addAttribute( “名”,值)
和
spring-mvc中的mv.addObject(“name”,value)?
模型是模型
mv是ModelAndView
最佳答案
Model#addAttribute(String, Object)州
Add the supplied attribute under the supplied name.
而ModelAndView#addObject(String, Object)则表示
Add an attribute to the model.
如果你看一下addObject的源代码
public ModelAndView addObject(String attributeName, Object attributeValue) { getModelMap().addAttribute(attributeName, attributeValue); return this; }它委托ModelAndView持有并在其上调用addAttribute()的Model引用.
点击查看更多相关文章
转载注明原文:java – model.addAttribute(“name”,value)和mv.addObject(“name”,value)之间的差异? - 乐贴网