日期:2014-05-17  浏览次数:20764 次

怎么把电脑上登录的用户信息存在cookie里面,在下次打开的时候方便检索历史登录过的用户名
怎么把电脑上登录的用户信息存在cookie里面,在下次打开登陆页面的时候方便检索历史登录过的用户名 求高人指导,不胜感激

------解决方案--------------------
Java code

    public String execute() throws Exception{
        Cookie cookie = new Cookie("user",getUsername());
        cookie.setMaxAge(60*60);
        response.addCookie(cookie);
        return "cook";
    }