Thymeleaf中去的作用域中数据的方法和jsp相似,熟悉jsp的开发者很容易学会 先看一个demo,Model,request,session,ServletContext中的数据 public String One(Model model, HttpServletRequest request, HttpSession session){ Person p1=queryPerson.query(1001); model.addAttribute("Tom",p1); model.addAttribute("req","hello"); request.setAttribute("req","Hello"); session.setAttribute("ses","Http!"); request.getServletContext().setAttribute("app","App"); return "Tom"; } model中的数据实际上就是request中的数据,以下写法都可以拿到数据 <h1 th:utext="${Tom.gender}">Hello</h1> <h1 th:utext="${req}">Hello</h1> <h1 th:utext="${#request.getAttribute('req')}"></h1> <h1 th:utext="${