Re: Sharing portlet session attributes with servlets

Tyler <[email protected]>
Newsgroups gmane.comp.jakarta.pluto.user
Message-ID <[email protected]>
Derek Richardson <Derek.Richardson <at> appiancorp.com> writes:

> 
> According to PLT.15.3:
> 
> Objects stored in the session using the PORTLET_SCOPE must be available
> to the portlet during requests for the same portlet window that the
> objects where stored from. The object must be stored in the
> APPLICATION_SCOPE with the following fabricated attribute name
> 'javax.portlet.p.<ID>?<ATTRIBUTE_NAME>'. <ID> is a unique identification
> for the portlet window (assigned by the portal/portlet-container) that
> must not contain a '?' character. <ATTRIBUTE_NAME> is the attribute name
> used to set the object in the PORTLET_SCOPE of the portlet session.
> 
> Attributes stored in the PORTLET_SCOPE are not protected from other web
> components of the portlet application. They are just conveniently
> namespaced.
> 
> How can I obtain the <ID> so that I can pass it to a servlet so that the
> servlet knows which portlet's attribute to use in processing?
> 
> Also, within what scope (session, application, forever) is <ID> unique?
> And is <ID> not only unique but also constant - i.e., the same portlet
> window will always have the same <ID>?
> 
> Thanks,
> 
> Derek
> 
> 
Derek,
When using JSR 168, and you want to pass PortletSession to HttpSession, view 
this link: http://www-03.ibm.com/developerworks/blogs/page/Joey_Bernal?
entry=portlet_session_scope_and_sharing

The key is to put PortletSession session = request.getPortletSession();
in you doView method of your Portlet class (not the pagecode).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.