掲示板
Portlet session sharing
7年前 に Manish Kumar Jaiswal によって更新されました。
Portlet session sharing
Regular Member 投稿: 153 参加年月日: 08/11/25 最新の投稿
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
6年前 に Asier Larrañaga によって更新されました。
RE: Portlet session sharing
New Member 投稿: 2 参加年月日: 17/01/03 最新の投稿
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?
Assuming that you want to pass attributes in session, please check If the solution in below link fixes your issue.
https://web.liferay.com/community/forums/-/message_boards/view_message/88949571#_19_message_88978751
https://web.liferay.com/community/forums/-/message_boards/view_message/88949571#_19_message_88978751
6年前 に Asier Larrañaga によって更新されました。
RE: Portlet session sharing
New Member 投稿: 2 参加年月日: 17/01/03 最新の投稿
Yes, PortalSessionThreadLocal worked for me.
Thank you so much.
Thank you so much.