@Controller public class DemoController { @RequestMapping("/showInfo5") public String showInfo5(HttpServletRequest request, Model model) { request.setAttribute("req", "HttpServletRequest"); request.getSession().setAttribute("sess", "HttpSession"); request.getSession().getServletContext().setAttribute("app", "Application"); return "index5"; } } <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Thymeleaf语法详解-获取作用域对象中的数据</title> </head> <body> Request:<span th:text="${#httpServletRequest.getAttribute('req')}"></span> <hr/> Session:<span th:text="${session.sess}"></span> <hr/> Application:<span th:text="${application.app}"></span>