Forums de discussion

Get Portal session attributes

robin thakur, modifié il y a 10 années.

Get Portal session attributes

Regular Member Publications: 146 Date d'inscription: 09/01/14 Publications récentes
Hi,

I want to know how to get Portal session attributes.

Thanks
thumbnail
Pankaj Kathiriya, modifié il y a 10 années.

RE: Get Portal session attributes

Liferay Master Publications: 722 Date d'inscription: 05/08/10 Publications récentes
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, modifié il y a 10 années.

RE: Get Portal session attributes

Regular Member Publications: 146 Date d'inscription: 09/01/14 Publications récentes
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, modifié il y a 10 années.

RE: Get Portal session attributes

Liferay Master Publications: 722 Date d'inscription: 05/08/10 Publications récentes
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, modifié il y a 10 années.

RE: Get Portal session attributes

Regular Member Publications: 146 Date d'inscription: 09/01/14 Publications récentes
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, modifié il y a 10 années.

RE: Get Portal session attributes

Liferay Master Publications: 722 Date d'inscription: 05/08/10 Publications récentes
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, modifié il y a 10 années.

RE: Get Portal session attributes

Regular Member Publications: 146 Date d'inscription: 09/01/14 Publications récentes
hi,

see the attached file. in this screenshot i want to get attributes value that i select there

Pièces jointes:

Natalia Safonova, modifié il y a 8 années.

RE: Get Portal session attributes

New Member Publications: 2 Date d'inscription: 18/07/14 Publications récentes
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, modifié il y a 10 années.

RE: Get Portal session attributes

Junior Member Publications: 47 Date d'inscription: 17/01/12 Publications récentes
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