当前位置:网站首页>销毁Session和清空指定的属性
销毁Session和清空指定的属性
2022-07-03 02:56:00 【一尾流鸢cd】
销毁session:
session.invalidate()
清除当前session的所有相关信息
清空session中的指定的属性:session.removeAttribute()
适用于清空指定的属性,括号中指定session的属性。
清空session:Session.Clear()
就是把Session对象中的所有项目都删除了,Session对象里面啥都没有。但是Session对象还保留。
session的removeAttribute()和invalidate()的区别
session.invalidate()是销毁跟用户关联session,例如有的用户强制关闭浏览器,而跟踪用户的信息的session还存在,可是用户已经离开了。
虽然session 生命周期浏览默认时间30分,但是在30分钟内别的用户还可以访问到前一个用户的页面,需销毁用户的session。
session.removeAttribute()移除session中的某项属性。
在spring例子中宠物商店的注销登录的代码:
request.getSession().removeAttribute(“userSession”);
// 注销用户,使session失效。
request.getSession().invalidate();
边栏推荐
- Pytest (6) -fixture (Firmware)
- 一文带你了解 ZigBee
- 力扣------网格中的最小路径代价
- Kubernetes cluster log and efk architecture log scheme
- JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
- How to limit the size of the dictionary- How to limit the size of a dictionary?
- [error record] the parameter 'can't have a value of' null 'because of its type, but the im
- sql server 查询指定表的表结构
- Check log4j problems using stain analysis
- What is the way out for children from poor families?
猜你喜欢
Practice of traffic recording and playback in vivo
Kubernetes family container housekeeper pod online Q & A?
内存泄漏工具VLD安装及使用
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
Sous - système I2C (IV): débogage I2C
[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)
I2C 子系統(四):I2C debug
I2C subsystem (IV): I2C debug
Choose it when you decide
Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception
随机推荐
I2C 子系统(三):I2C Driver
Andwhere multiple or query ORM conditions in yii2
SQL server queries the table structure of the specified table
[error record] the parameter 'can't have a value of' null 'because of its type, but the im
js根据树结构查找某个节点的下面的所有父节点或者子节点
Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
Distributed transaction
What does it mean when lambda is not entered?
How to limit the size of the dictionary- How to limit the size of a dictionary?
内存泄漏工具VLD安装及使用
vfork执行时出现Segmentation fault
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
Basic operation of binary tree (C language version)
[fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)
From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
Le processus de connexion mysql avec docker
Chart. JS multitooltip tag - chart js multiTooltip labels
HTB-Devel
Opengauss database development and debugging tool guide