使用Cookie存储客户端数据(如用户名),使用HttpSession实现登录状态管理,对比Cookie(存客户端)和Session(存服务端)Cookie默认关闭浏览器失效,设置setMaxAge()延长存活时间