SpringMVC中model,modelMap.request,session取值顺序

Model model,HttpServletRequest request, ModelMap map声明变量

request.getSession().setAttribute("test", "haiwei2Session");
request.setAttribute("test", "haiwei1request");
map.addAttribute("test", "haiweiModelMap");
model.addAttribute("test", "haiweiModel");

我通过${test}这个方式取值,优先取Model和ModelMap的,Model和ModelMap是同一个东西,谁最后赋值的就取谁的,然后是request,最后是从session中获取

你可能感兴趣的:(idea)