如何在Liferay中释放会话变量?

如何在Liferay中释放会话变量?,liferay,liferay-6,liferay-theme,Liferay,Liferay 6,Liferay Theme,在Liferay中,我使用会话变量进行Interpartlet通信 PortletSession psession = request.getPortletSession(); String userId = (String) psession.getAttribute("userId", PortletSession.APPLICATION_SCOPE); 在使用这个变量之后,我想销毁它 如何销毁、废弃liferay中的会话变量 使用PortletSession的removeAttribut

在Liferay中,我使用会话变量进行Interpartlet通信

PortletSession psession = request.getPortletSession();
String userId = (String) psession.getAttribute("userId", PortletSession.APPLICATION_SCOPE);
在使用这个变量之后,我想销毁它


如何销毁、废弃liferay中的会话变量

使用PortletSession的removeAttribute方法。它将从会话中删除属性

在您的情况下,
psession.removeAttribute(“userId”)

这也适用于请求和会话属性