掲示板
Portlet Session
Hello, I have a portlet class that extends the GenericPortlet. I am having difficult in accessing data out of session in one of my portlet JSP. I can access data out of session from one portlet class to another rportlet class (i.e class <->class)using PortletSession object but I can not get data from another portlet jsp (i.e class->JSP).
Here are details below:
:
PORTLET A (class)
INSIDE PORTLET CLASS:
@ProcessAction(name = "processClaim")
public void processClaim(ActionRequest actionRequest,ActionResponse actionResponse){
actionRequest.getPortletSession().setAttribute("closedText", resp.getClosedText(), PortletSession.APPLICATION_SCOPE); <- Settion data in Session in Portlet A
actionResponse.sendRedirect(viewMyRegisteredClaimPage+"?id="+ref);
}
PORTLET B (jsp)
INSIDE REDIRECTED PORTLET JSP:
HttpServletRequest r = PortalUtil.getHttpServletRequest(renderRequest);
String claimReference = PortalUtil.getOriginalServletRequest(r).getParameter("id");
String closedCLaim = (String)portletSession.getAttribute("closedText"); <- Retrieving the data out of session in Portlet B
System.out.println("CLOSED TEXT = ["+closedCLaim+"]");
I am getting null when trying to get closedText.
How can I get or read the values from Session?
Thanks,
Kevin
Here are details below:
:
PORTLET A (class)
INSIDE PORTLET CLASS:
@ProcessAction(name = "processClaim")
public void processClaim(ActionRequest actionRequest,ActionResponse actionResponse){
actionRequest.getPortletSession().setAttribute("closedText", resp.getClosedText(), PortletSession.APPLICATION_SCOPE); <- Settion data in Session in Portlet A
actionResponse.sendRedirect(viewMyRegisteredClaimPage+"?id="+ref);
}
PORTLET B (jsp)
INSIDE REDIRECTED PORTLET JSP:
HttpServletRequest r = PortalUtil.getHttpServletRequest(renderRequest);
String claimReference = PortalUtil.getOriginalServletRequest(r).getParameter("id");
String closedCLaim = (String)portletSession.getAttribute("closedText"); <- Retrieving the data out of session in Portlet B
System.out.println("CLOSED TEXT = ["+closedCLaim+"]");
I am getting null when trying to get closedText.
How can I get or read the values from Session?
Thanks,
Kevin
Kevin,
You can retrieve or read the values from Session like this.
Read session:
PortletSession session= renderRequest.getPortletSession();
String str= (String)session.getAttribute("sessionValue",PortletSession.APPLICATION_SCOPE);
Kindly Refer this link also,
https://www.liferay.com/community/forums/-/message_boards/message/13435987
http://www.liferayaddict.com/home/-/blogs/45920;jsessionid=7224077DADC6AB8D8C61849FC2B053FE
Regards,
Ritesh
You can retrieve or read the values from Session like this.
Read session:
PortletSession session= renderRequest.getPortletSession();
String str= (String)session.getAttribute("sessionValue",PortletSession.APPLICATION_SCOPE);
Kindly Refer this link also,
https://www.liferay.com/community/forums/-/message_boards/message/13435987
http://www.liferayaddict.com/home/-/blogs/45920;jsessionid=7224077DADC6AB8D8C61849FC2B053FE
Regards,
Ritesh