Fórum

Get Portal session attributes

robin thakur, modificado 10 Anos atrás.

Get Portal session attributes

Regular Member Postagens: 146 Data de Entrada: 09/01/14 Postagens Recentes
Hi,

I want to know how to get Portal session attributes.

Thanks
thumbnail
Pankaj Kathiriya, modificado 10 Anos atrás.

RE: Get Portal session attributes

Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
If you want to access httpsession's attributes then you can get httpServeltRequest by
PortalUtil.getHttpServletRequest(portletRequest)
, and from httpServeltRequest you can get httpSession by httpServeltRequest .getSession() , and session attributes by httpSession.getAttribute("name").

Let us know if you are asking for something else.

HTH
Regards
robin thakur, modificado 10 Anos atrás.

RE: Get Portal session attributes

Regular Member Postagens: 146 Data de Entrada: 09/01/14 Postagens Recentes
Hi Pankaj,

I know this and I already done but my problem is I am setting portletsession attribute in my firstportlet and also doing render-wieght. After executing the first i get the value in second portlet but I am not getting how i can access it from renderRequest as the attributes are set in some portalSession.
so let me know how do i get this from my render request.


thanks
thumbnail
Pankaj Kathiriya, modificado 10 Anos atrás.

RE: Get Portal session attributes

Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
In liferay-portlet.xml, set <private-session-attributes>false</private-session-attributes> to share portlet's session attributes.

From renderRequest, you can portletSession by renderRequest.getPortletSession() and hence its attributes.


Regards.
robin thakur, modificado 10 Anos atrás.

RE: Get Portal session attributes

Regular Member Postagens: 146 Data de Entrada: 09/01/14 Postagens Recentes
I already done this. what I am saying that iam getting value in render request object of my second portlet but the problem is the value appears in portal session. So how i got it.
If you know some another way to get values from render request , let me know.

thanks
thumbnail
Pankaj Kathiriya, modificado 10 Anos atrás.

RE: Get Portal session attributes

Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
Cant you use PortalUtil.getHttpServletRequest(renderRequest) and then from httpServletRequest.getSession() get session attributes ?

Your question is not clear . Please elaborate more.

Regards
robin thakur, modificado 10 Anos atrás.

RE: Get Portal session attributes

Regular Member Postagens: 146 Data de Entrada: 09/01/14 Postagens Recentes
hi,

see the attached file. in this screenshot i want to get attributes value that i select there
Natalia Safonova, modificado 8 Anos atrás.

RE: Get Portal session attributes

New Member Postagens: 2 Data de Entrada: 18/07/14 Postagens Recentes
set private-session-attributes in liferay-portlet.xml to false for both portlets. It was the solution for me
https://www.liferay.com/community/wiki/-/wiki/Main/Session+Sharing
thumbnail
Murali Krishna, modificado 10 Anos atrás.

RE: Get Portal session attributes

Junior Member Postagens: 47 Data de Entrada: 17/01/12 Postagens Recentes
robin thakur:
Hi Pankaj,

I know this and I already done but my problem is I am setting portletsession attribute in my firstportlet and also doing render-wieght. After executing the first i get the value in second portlet but I am not getting how i can access it from renderRequest as the attributes are set in some portalSession.
so let me know how do i get this from my render request.


thanks



Hi Robin,

seems like your second portlet is called before first portlet. check it again with render weight parameter in liferay. https://www.liferay.com/community/forums/-/message_boards/message/6042859. Portlets with a greater render weight have greater priority and will be rendered before portlets with a lower render weight

Murali