• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sharing data Between portlets

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using two different portlets in my Portal Application i intend to share data between this two portlets, I tried

PortletRequest request=(PortletRequest)FacesContext.getCurrentInstance().getExternalContext.getRequest();
PortletSession ps=request.getPortletSession();
ps.setAttribute("Test","Test");

But unfortunately i am unable to retrieve this in my other Portlet, I am using websphere portal Server 6
 
Ravi Kumar Ravuru
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can use application scope of portlet session to share the data between the portlets.You can go through JSR 168 Specs for the same.

Ravi
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to do something like this:

String visitCount =
(String)session.getAttribute("timesvisited",PortletSession.APPLICATION_SCOPE);


PortletSession.APPLICATION_SCOPE needs to go in there.

Here's a little tutorial on understanding the various Portlet scopes:

Understanding the JSR168 PortletSession Scopes

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic