In a Liferay MVC project how can I set portletSession
in JSP page and retrieve portletSession
in a custom action class?
From JSP you don't need to do anything because is one of the objects provided:
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
<%
portletSession.getAttribute(...);
%>
From a class is not a big deal neither, it's available in your render or action methods:
PortletSession portletSession = actionRequest.getPortletSession(); // action method
PortletSession portletSession = renderRequest.getPortletSession(); // render method