CookieManager.addCookie(response , "remember" , remember , loginMaxAge);
}else {
loginMaxAge = 24*60*60; //不自动登陆则为一天
}
UserInfo userInfo = das.queryUserInfoByUserName(userName);
CookieManager.addCookie(response , "login_username" , userName , loginMaxAge);
CookieManager.addCookie(response , "login_password" , password , loginMaxAge);
CookieManager.addCookie(response , "login_nickname" , URLEncoder.encode(userInfo.getNickName(), "UTF-8") , loginMaxAge);
session.setAttribute("userName",userName);
if(userInfo != null) //中文名
session.setAttribute("userAlis", userInfo.getNickName());
//更新最后登陆时间
userInfo.setLastLoginTime(new Timestamp(System.currentTimeMillis()));
das.updateUserInfo(userInfo);
if (targetUrl != null && !targetUrl.equals("")) {
return targetUrl; //跳转到目标页
}else {