Springboot操作域对象

1,HttpServletRequest

  request.setAttribute("req","HttpServletRequest");

  <span th:text="${#httpServletRequest.getAttribute('req')}"></span>

  <span th:text="${#request.getAttribute('req')}"></span>

2,HttpSession

  request.getSession().setAttribute("ses","HttpSession")

  <span th:text="${session.ses}"></span>

  <span th:text="${#session.getAttribute('ses')}"></span>

3,ServletContext

  request.getSession().getServletContext().setAttribute("app","Application")

  <span th:text="${application.app}"></span>

  <span th:text="${servletContext.getAttribute('app')}"></span>

posted @ 2020-04-28 10:10  拯代码  阅读(601)  评论(0编辑  收藏  举报