ServletContext context = httpRequest.getSession()
.getServletContext();
ApplicationContext applicationContext = WebApplicationContextUtils
.getWebApplicationContext(context);
// 从spring中获得服务
UserInfoService userInfoService = (UserInfoService) applicationContext
.getBean("userInfoService");
UserInfo userInfoTemp = userInfoService
.getUserInfoByRememberMe(loginName, rememberMe);
if (userInfoTemp != null) {
httpRequest.getSession().setAttribute(
GlobalConf.USER_SESSION, userInfoTemp);
// 如果教研成功就更新记住我的key.更安全.
String remembermeKey = userInfoService
.updateUserInfoRememberMe(userInfoTemp.getId());
Cookie cookie = new Cookie("rememberme", remembermeKey);
cookie.setMaxAge(60 * 60 * 24 * 30);
httpResponse.addCookie(cookie);
cookie = new Cookie("loginName",