ModelAndView 原

ModelAndView mav=new ModelAndView("test1");
mav.addObject("time", new Date());
mav.addObject("time2", "吴");
mav.getModel().put("name", "pmb");
return mav;

addObject   与 getModel().put  可视为等价

public class ModelAndView {

   /** View instance or view name String */
   private Object view;

   /** Model Map */
   private ModelMap model;

   /** Indicates whether or not this instance has been cleared with a call to {@link #clear()} */
   private boolean cleared = false;
public class ModelMap extends LinkedHashMap<String, Object> {

   /**
    * Construct a new, empty {@code ModelMap}.
    */
   public ModelMap() {
   }

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券