Re: Accessing Portlet Session parameters in Freemarker
sunil <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Daniel Dekany <ddekany <at> freemail.hu> writes: > > > > after lot of trial and error I found out that we need to keep the Portlet > > Session attributes in the Application scope to access them in the template > > files. You cant access the session attributes if they are present in the > > Portlet Scope. > > I don't get how could you put session attributes into the application > scope... after all, the point of session attributes is that they can > be different for each visitors, while application scope attributes are > common among each visitors. ************************************* Yes, what you are saying is correct but when it comes to Portlet Session its not the same. This is what mentioned Portlet Session specification. ------------------------ The PortletSession interface provides a way to identify a user across more than one request and to store transient information about that user. A PortletSession is created per user client per portlet application. A portlet can bind an object attribute into a PortletSession by name. The PortletSession interface defines two scopes for storing objects: APPLICATION_SCOPE PORTLET_SCOPE All objects stored in the session using the APPLICATION_SCOPE must be available to all the portlets, servlets and JSPs that belongs to the same portlet application and that handles a request identified as being a part of the same session. 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. Attributes stored in the PORTLET_SCOPE are not protected from other web components of the portlet application. They are just conveniently namespaced. ------------------------------------------ Now the issue is if Iam trying to store the attributes in PORTLET_SCOPE, Iam not able to access those in the freemarker template files. So, I forced to keep them in the APPLICATION_SCOPE which freemarker template files can access. but as they are stored in the APPLICATION_SCOPE they are open to all the other portlets running as part of same Portal application which might be able to change the Portlet attributes. do we have any solution to resolve this issue so that freemarker template files can access the attributes present in the PORTLET_SCOPE aslo? ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone