如何在Liferay中释放会话变量



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

PortletSession psession = request.getPortletSession();
String userId = (String) psession.getAttribute("userId", PortletSession.APPLICATION_SCOPE);

在使用这个变量之后,我想销毁它。

如何销毁,废弃会话变量在生命周期?

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

在你的例子中,psession.removeAttribute("userId");

最新更新