码迷,mamicode.com
首页 > 编程语言 > 详细

springMVC中得到request对象,session对象

时间:2015-08-26 09:27:44      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:

http://blog.csdn.net/is_zhoufeng/article/details/7559756

 

RequestAttributes ra = RequestContextHolder.getRequestAttributes();
HttpServletRequest request = ((ServletRequestAttributes)ra).getRequest();
request.getSession().setAttribute("sessionMessage", "im‘sessionMessage!");

或者

 @RequestMapping("/main/login")
    public String userLogin(String yhdm,
            HttpSession httpSession, HttpServletRequest request) {
         
        httpSession.setAttribute("clientUser", "a");
        request.getRemodeAddr();
        return "main/framework";
    }

 

springMVC中得到request对象,session对象

标签:

原文地址:http://www.cnblogs.com/stono/p/4759222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!