Java Controller获取request

  • Post author:
  • Post category:java


		ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
       //获取reuqest
        HttpServletRequest request = attributes.getRequest();
        //获取session
        HttpSession sess = request.getSession();
        sess.setAttribute("a", "路");
		System.out.println("123:"+sess.getAttribute("a"));



版权声明:本文为WXN069原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。