Session
# Session
服务器端会话管理技术 本质也是客户端会话管理技术
在客户端保存的是一个特殊标识,而共享的数据保存到服务器端内存对象中
# 获取 httpSession
- getSession () 获取 httpSession 对象
- getSession (boolean create) 获取 httpSession 对象,未获取是否自动创建 默认为 ture
# Session 方法
需要借助请求对象中的 getSession () 返回一个 httpSession 对象
- setAttribute (String,Object value) 设置共享数据
- getAttribute (String name) 获取共享数据
- removeAttribute (String name) 移除共享数据
- getId () 获取唯一标识名称
- Invalidate () 让 session 立即失效
编辑 (opens new window)
上次更新: 2023/12/06, 01:31:48