当前位置:网站首页>销毁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();
边栏推荐
- I2C 子系统(三):I2C Driver
- Add automatic model generation function to hade
- How to use asp Net MVC identity 2 change password authentication- How To Change Password Validation in ASP. Net MVC Identity 2?
- I2C 子系统(一):I2C spec
- 超好用的日志库 logzero
- Super easy to use logzero
- SqlServer行转列PIVOT
- 当lambda没有输入时,是何含义?
- sql server 查询指定表的表结构
- Add MDF database file to SQL Server database, and the error is reported
猜你喜欢

xiaodi-笔记

Sqlserver row to column pivot

SQL statement

Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers

Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
![[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)](/img/04/88ce45d370a2e6052c2fce558aa531.jpg)
[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/c7/6b5ab4ff7379bfccff7cdbb358ff8f.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]

Distributed transaction

Classes and objects - initialization and cleanup of objects - constructor call rules

Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
随机推荐
Apple releases MacOS 11.6.4 update: mainly security fixes
Add MDF database file to SQL Server database, and the error is reported
Baidu map - surrounding search
Add automatic model generation function to hade
Random Shuffle attention
Strategy application of Dameng database
SQL statement
C language beginner level - pointer explanation - paoding jieniu chapter
I2C subsystem (II): I3C spec
迅雷chrome扩展插件造成服务器返回的数据js解析页面数据异常
HW initial preparation
Pytest (6) -fixture (Firmware)
Linear rectification function relu and its variants in deep learning activation function
Use optimization | points that can be optimized in recyclerview
Kubernetes cluster log and efk architecture log scheme
The left value and the right finger explain better
The difference between left value and right value in C language
Random shuffle note
Super easy to use logzero
Summary of interview project technology stack