Reputation: 319
I am using Portlet to Portlet Communication.In which I created Portlet Session in one Portlet and set attribute.Getting that attribute in second portlet.Now I want to end that session.How can I do this?
Upvotes: 1
Views: 1728
Reputation: 5226
If you are catching session value in another portlet controller simply use
actionrequest.getPortletSession().removeAttribute("attributeName");
and if you are using Session scope it is better to use
actionRequest.getPortletSession().removeAttribute("attributeName",scopeId);
scopeId can be either one of them
PortletSession.APPLICATION_SCOPE or PortletSession.PORTLET_SCOPE
And now for handling session in jsp (which i rather don't),
PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);
portletRequest.getPortletSession().removeAttribute("attributeName");
Upvotes: 3