Thymeleaf - ${…}
@GetMapping("/upload/{id}")
public String uploadFile(@PathVariable("id") String id, ModelMap modelMap, HttpServletRequest request, HttpSession session)
{
//两种获取HttpSession方式相同
request.getSession().setAttribute("aa","556");
session.setAttribute("bb","996");
modelMap.addAttribute("id",id);
return prefix + "/upload";
}
注意:session中的属性获取需要session.*方式获取