Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Srikanth Reddy
Sharing HttpSession value in Different portlets in different pages
March 8, 2011 11:36 PM
Answer

Srikanth Reddy

Rank: Junior Member

Posts: 53

Join Date: June 17, 2010

Recent Posts

hi all,
I am facing an issue can any one help me here.
I am storing a a map value in httpsession in one portlet.
by using the following method

HttpServletRequest httpRequest = (HttpServletRequest)
PortalUtil.getOriginalServletRequest(PortalUtil
.getHttpServletRequest(request));
HttpSession httpSession = httpRequest.getSession();


and storing the value .

But when i am trying to retrieve the same value in DoView() of another portlet.
like this :
//getting httpSession from portletRequest
HttpServletRequest httpServletRequest = (HttpServletRequest)PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request));
HttpSession httpSession = httpServletRequest.getSession(true);

I am getting Null .


Can any one let me know how to share a variable through HttpSession ,which is avialable across whole portlet ,i mean in different portlets.


Thanks And regards
Srikanth
Dhandapani S
RE: Sharing HttpSession value in Different portlets in different pages
March 9, 2011 1:43 AM
Answer

Dhandapani S

Rank: Regular Member

Posts: 163

Join Date: March 24, 2009

Recent Posts

Hi Srikanth,


Why are u using HttpSession? if u want to share the values across different portlets or pages, u can go for IPC or else u can go for PortletSession with Applicaton_SCOPE...

I hope it will help u.

Regards

Dhandapani S