Liferay Portlet之间Session通信

1.存Session

portletSession.setAttribute("LIFERAY_SHARED_KEY_NAME","VALUE",PortletSession.APPLICATION_SCOPE);

注:KEY值必须添加"LIFERAY_SHARED_"这个前缀


2.在别一个Portlet取Session

portletSession.getAttribute("LIFERAY_SHARED_KEY_NAME",PortletSession.APPLICATION_SCOPE)



Portlet A 添加:

PortletSession session = request.getPortletSession();    
session.setAttribute("LIFERAY_SHARED_directive", "test" ,PortletSession.APPLICATION_SCOPE); 

Portlet B 使用:

PortletSession portletSession = request.getPortletSession();    
String directive = (String)portletSession.getAttribute("LIFERAY_SHARED_directive",PortletSession.APPLICATION_SCOPE); 


(1)