留言板
Portlet session sharing
Hi Friends ,
I was just trying to use com.liferay.portlet.private-session-attributes=false to share some value between 2 portlets (IPC) in Liferay 7 .
this should be very simple but i don't know where i am going wrong .I have created 2 portlets
1) Sender
2) Receiver
Sender has this code
I get the value of userEmailAddress here .
and receiver has this code
here i don't get the value of userEmailAddress . So what is wrong in the code . I think this should be simple but I don't know what is wrong here . Can some one help me out . Thanks in advance ...Manish
I was just trying to use com.liferay.portlet.private-session-attributes=false to share some value between 2 portlets (IPC) in Liferay 7 .
this should be very simple but i don't know where i am going wrong .I have created 2 portlets
1) Sender
2) Receiver
Sender has this code
@Component(
immediate = true,
property = {
"com.liferay.portlet.display-category=category.sample",
"com.liferay.portlet.instanceable=true",
"javax.portlet.display-name=IPC-PortletSession-Sender Portlet",
"javax.portlet.init-param.template-path=/",
"javax.portlet.init-param.view-template=/view.jsp",
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=power-user,user",
"com.liferay.portlet.private-session-attributes=false"
},
service = Portlet.class
)
public class IPCPortletSessionSenderPortlet extends MVCPortlet {
@ProcessAction(name = "getData")
public void getData(ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException, SystemException {
String userEmailAddress = ParamUtil.getString(actionRequest, "userEmailAddress");
PortletSession portletSession = actionRequest.getPortletSession();
System.out.println("userEmailAddress >>"+userEmailAddress);
portletSession.setAttribute("userEmailAddress", userEmailAddress, PortletSession.APPLICATION_SCOPE);
}
}
I get the value of userEmailAddress here .
and receiver has this code
@Component(
immediate = true,
property = {
"com.liferay.portlet.display-category=category.sample",
"com.liferay.portlet.instanceable=true",
"javax.portlet.display-name=IPC-PortletSession-Receiver Portlet",
"javax.portlet.init-param.template-path=/",
"javax.portlet.init-param.view-template=/view.jsp",
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=power-user,user",
"com.liferay.portlet.private-session-attributes=false"
},
service = Portlet.class
)
public class IPCPortletSessionReceiverPortlet extends MVCPortlet {
@Override
public void render(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
String message = null;
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletSession portletSessionobject = renderRequest.getPortletSession();
String userEmailAddress = (String)portletSessionobject.getAttribute("userEmailAddress", PortletSession.APPLICATION_SCOPE);
System.out.println("userEmailAddress >>>>>>>>>>>>>"+userEmailAddress);
super.render(renderRequest, renderResponse);
}
}
here i don't get the value of userEmailAddress . So what is wrong in the code . I think this should be simple but I don't know what is wrong here . Can some one help me out . Thanks in advance ...Manish
Hi Manish
I am facing same problem, if u got the solution please share with me.
Thanks in advance varun
I am facing same problem, if u got the solution please share with me.
Thanks in advance varun
According to this issue, https://issues.liferay.com/browse/LPS-66826, portlet session sharing doesn't work in Liferay 7 GA3.
It looks like it is fixed for DXP, but can this be fixed in CE?
It looks like it is fixed for DXP, but can this be fixed in CE?