webExplorer
webExplorer

Reputation: 1025

How to free a session variable in Liferay?

In Liferay, I'm using session variables for InterPortlet Communication.

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

After use of this variable, I want to destroy it.

How to destroy, scrap the session variables in liferay?

Upvotes: 1

Views: 559

Answers (1)

Pankaj Kathiriya
Pankaj Kathiriya

Reputation: 4210

Use removeAttribute method of PortletSession. It will remove attribute from session.

In your case psession.removeAttribute("userId");

This is applicable to request and session attributes also.

Upvotes: 1

Related Questions