jsp - JSF 按钮重置 session

标签 jsp jsf jakarta-ee java-ee-5

当用户单击按钮时,有没有办法为用户重置(清除) session ?

最佳答案

关于什么

session.invalidate(); 

invalidate method of session object is used to discard the session and releases any objects stored as attributes. This method helps to reduce memory overhead and achieves improvement in performance. It is always a good practice to explicitly remove or invalidate sessions using session.invalidate() method.



或者
session.removeAttribute(String) 

The removeAttribute method of session object is used to remove the attribute and value from the session.

关于jsp - JSF 按钮重置 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1503550/

相关文章:

jsf - Primefaces DataGrid - CommandLink 不起作用

java - 如何在本地 TomCat 服务器托管的 JSF 应用程序中使用在外部 JAR 中声明的接口(interface)

java - Web 应用程序中的 Jboss 共享库

java - 如果抛出异常,如何防止 XML 文件内容被修改

java - jsp中的多个结果集

Java:服务器端类上的静态字符串数组

jsf - 跨多个 View 持久化 ViewScoped bean

hibernate - org.hibernate.MappingException : Unable to find column with logical name

java - 从应用程序写入数据库时​​,Murach 的 Java Servlets 第三版出现 NullPointerException

javascript - 在 javascript 中循环 html 复选框