Reputation: 27055
In my Portlet I set some attributes in the session which I wish to use in the velocity template that Liferay uses.
I set the attributes on PortletSession
as follows:
portletSession.setAttribute("key", "value", PortletSession.APPLICATION_SCOPE);
Now I wish to use these in my home.vm
template of Liferay, but whatever I tried, nothing works:
$request.get("key")
$request.getAttribute("key")
$request.getSession().getAttribute("key")
$session.getAttribute("key")
I even put the key in the portal.properties:
session.shared.attributes=key
But that does not seem to work either. Can anyone point me in the right direction?
Upvotes: 0
Views: 2658
Reputation: 430
It should be sufficient to add the "LIFERAY_SHARED_" prefix to your session attribute name since the session.shared.attributes property's value contains it by default.
Upvotes: 0
Reputation: 27055
Found the answer myself.
Apparantly I needed to set the private-session-attributes
to false. I tried that before, but the DTD is very specific where it needs the tag.
After placing it at the right place, it worked.
Upvotes: 2