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.*方式获取

 

posted @ 2022-05-02 23:12  花田007  阅读(40)  评论(0编辑  收藏  举报