JSP session.invalidate() 与 request.logout() [英] JSP session.invalidate() vs request.logout()
本文介绍了JSP session.invalidate() 与 request.logout()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 jsp 页面上有一个注销按钮.(Tomcat 8.0.15)
I have a SignOut button on my jsp page. (Tomcat 8.0.15)
session.invalidate()
或
request.logout()
哪个更适合退出/终止会话,主要区别是什么?我应该两者都用吗?
which one is better for signing-out/terminating the session, what is the main difference? Should I use both?
推荐答案
logout()
清除请求中的身份信息但不影响会话invalidate()
使会话无效,但不影响请求中的身份信息.logout()
clears the identity information in the request but doesn't affect the sessioninvalidate()
invalidates the session but doesn't affect the identity information in the request.
我认为你应该同时使用两者.
I think you should use both.
这篇关于JSP session.invalidate() 与 request.logout()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文