4 Replies Latest reply on Jan 30, 2007 9:12 AM by herveminko

    Saving object in PortletSession

    herveminko

      Hi guys,

      I have a problem aving objects in a PortletSession. I want to save obejcts i nthe PortletSession of JBoss Portal 2.2.1 using the method setAttribute(key, Value, PortletSession.APPLICATION_SCOPE), because those attributes must be shared with other Portlers of the same Portlet Application. My java code looks like:

      ArrayList myObjects = MYClass.getMyObjects();
      session.setAttribute("obj", myObjects, PortletSession.APPLICATION_SCOPE);

      After doing this, i want to retrieve my saved objects with the statement:
      ArrayList myObjects2 = session.get("obj");

      Unfortunately i get "null" as return value, because the key "obj" is not present in the PortletSession object. After investigating the cause of this strange behaviour, i found out that my obects are not stored with my choses kex "obj", but with the key "jbp19367721obj".

      jbp19367721 seems to be the window ID of my portlet window. Is there a possibility to store objects in the application scope without using this window ID? Is it a particularity of JBoss Portal 2.2.1? It is very important for me to find a way to sidestep this window ID for saving my attributes in the PortletSession.
      Thanks in advance.