Loading

springMVC中得到request对象,session对象

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";
    }

 

posted @ 2015-08-26 08:15  stono  阅读(759)  评论(0编辑  收藏  举报