4 Replies Latest reply on Nov 1, 2006 4:47 PM by Brian McGovern

    Using PortletSession, sharing objects between portlets

    Brian McGovern Newbie

      Im using the following code setting a simple string in the portlet session's APPLICATION scope in portlet A. Reading it with portlet B. and its always returning null in portlet B. I'm missing something simple can anyone clue me in?


      Portlet A -- works just fine

      java.util.Date zDate = new java.util.Date();
      PortletSession zSession = request.getPortletSession();
      zSession.setAttribute("foo.timestamp", zDate.toString(), PortletSession.APPLICATION_SCOPE);
      System.out.println("Session Date ::" + (String)zSession.getAttribute("foo.timestamp", PortletSession.APPLICATION_SCOPE));


      Portlet B -- returns null.
      PortletSession zSession = request.getPortletSession();
      System.out.println("Session Date ::" + (String)zSession.getAttribute("foo.timestamp", PortletSession.APPLICATION_SCOPE));