标签:
ModelAndView:Model资料物件+View资料物件;构成spring mvc 中页面显示时需要的的所有资料物件;View用来渲染暴露的Model模型;
ModelAndView有7个构造方法如下:
public ModelAndView()
public ModeAndView(String viewName)
public ModeAndView(String viewName, Map<String ?> model)
public ModeAndView(String viewName, String modelName , Object modelObject)
public ModeAndView(View view)
public ModeAndView(View view, Map<String ?> model)
public ModeAndView(View view, String modelName, Object modelObject)
部分添加设置、属性的方法:
setView(View view)
为ModelAndView设置一个View
getView()
setViewName(String viewName)
getViewName()
addObject(String attributeName,Object attributeValue)
添加名字为attributeName、值为attributeValue的model对象
addObject(Object attributeValue)
添加值为attributeValue的model对象
标签:
原文地址:http://www.cnblogs.com/luoh/p/4315464.html