<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Outject session scoped attributes from portlet to portal</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111800992" />
  <subtitle>Outject session scoped attributes from portlet to portal</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111800992</id>
  <updated>2026-04-04T11:59:18Z</updated>
  <dc:date>2026-04-04T11:59:18Z</dc:date>
  <entry>
    <title>RE: Outject session scoped attributes from portlet to portal</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111837149" />
    <author>
      <name>Amos Fong</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111837149</id>
    <updated>2018-12-18T22:14:11Z</updated>
    <published>2018-12-18T22:14:11Z</published>
    <summary type="html">&lt;p&gt;If you're in a portlet, try setting private-session-attributes to false.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;However you may want to read Dave's blog on this issue and find a
  different method to achieve what you want:&lt;/p&gt;
&lt;p&gt;
  &lt;a href="https://community.liferay.com/blogs/-/blogs/resident-evil-death-to-sessions"&gt;https://community.liferay.com/blogs/-/blogs/resident-evil-death-to-sessions&lt;/a&gt;&lt;/p&gt;</summary>
    <dc:creator>Amos Fong</dc:creator>
    <dc:date>2018-12-18T22:14:11Z</dc:date>
  </entry>
  <entry>
    <title>Outject session scoped attributes from portlet to portal</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111800991" />
    <author>
      <name>Ghenadii Batalski</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111800991</id>
    <updated>2018-12-13T13:15:48Z</updated>
    <published>2018-12-13T13:15:48Z</published>
    <summary type="html">&lt;p&gt;Hello Community,&lt;/p&gt;
&lt;p&gt;we've got a very simple requierement to show some information about
  the logged in user in a header of a portal. For that simple feature i
  would &amp;quot;outject&amp;quot; some attribute into the global session scope
  of the logged in user and grasp it somewhere in an .ftl template e.g.:&lt;/p&gt;
&lt;pre&gt;
HttpSession session = request.getSession();
session.setAttribute(&amp;quot;MYATTR&amp;quot;, attrvalue);
&lt;/pre&gt;
&lt;p&gt;just in the near of the &lt;/p&gt;
&lt;pre&gt;
session.setAttribute(CASWebKeys.CAS_LOGIN, login);&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;But this intuitive approach just won't work for MYATTR (despite it
  nicely works for CAS_LOGIN). I already tried to prefix the attribute
  with LIFERAY_SHARED_ but without effect. It worth mentioning that
  the  documentation of &lt;/p&gt;
&lt;pre&gt;
session.shared.attributes&lt;/pre&gt;
&lt;p&gt;already warns about the impossibility:&lt;/p&gt;
&lt;pre&gt;
Note that this property is used to specify the sharing of session attributes from the portal to the portlet. This is not used to specify session sharing between portlet WARs or from the portlet to the portal.&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;but what is the correct solution for such a simple requirement?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thank you and regards, Gena&lt;/p&gt;</summary>
    <dc:creator>Ghenadii Batalski</dc:creator>
    <dc:date>2018-12-13T13:15:48Z</dc:date>
  </entry>
</feed>
