Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8195515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:10:00+00:00 2026-06-07T05:10:00+00:00

I am developing a JSF 2 Portlet, but i need get global session variable.

  • 0

I am developing a JSF 2 Portlet, but i need get global session variable.

The request works fine with:

FacesContext facesContext = FacesContext.getCurrentInstance();
    PortletRequest request = (PortletRequest) facesContext.getExternalContext().getRequest();

But the session is null:

PortletSession session = request.getPortletSession(false);

if put this code in liferay-portlet.xml file works fine, but i can’t do IPC: Inter Portlet Comunication

<!-- Portlet session -->
    <private-request-attributes>false</private-request-attributes>
    <private-session-attributes>false</private-session-attributes>

How i get and set variables session without use the last code?

Thanks

Today i i tried with this:

FacesContext facesContext = FacesContext.getCurrentInstance(); 
PortletRequest request = (PortletRequest) facesContext.getExternalContext().getRequest(); 
HttpServletRequest httpRequest = PortalUtil.getHttpServletRequest(request); 
HttpSession session = httpRequest.getSession(true); 
System.out.println(session.getAttribute("XXXX"));

but is null

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:10:02+00:00Added an answer on June 7, 2026 at 5:10 am

    Warning: Using <private-session-attributes>false</private-session-attributes> with Liferay Faces has been known to cause memory leaks. Use at your own risk!

    I solved my problem configuring liferay-portlet.xml

    1.) I changed the liferay-portlet.xml only with:

    <private-session-attributes>false</private-session-attributes>
    

    2.) In the Java Class i created method:

    FacesContext facesContext = FacesContext.getCurrentInstance();
    PortletRequest request = (PortletRequest) facesContext.getExternalContext().getRequest();
    PortletSession session = request.getPortletSession(false);
    

    If you get session attributes

    session.getAttribute("XXXXXX",PortletSession.APPLICATION_SCOPE);
    

    If you set session attributes

    session.setAttribute("NAME","VALUE",PortletSession.APPLICATION_SCOPE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Java Web Application using JSF, Spring and Hibernate. I need
i am developing in JSF a Spring Security application. the login form is fine.
I'm developing web-application with JSF. I tested it as I was able to but
I'm developing a JSF 2.0 portlet for Liferay 6.0.6 (Plugins SDK 6.1) and I
I'm developing a simple JSF application, but I'm stuck again... Basically, I have a
I am developing a JSF application with JPA(EclipseLink 2.0) and Primefaces. I want to
I'm developing a JSF web application, with the current 2.1.7 JSF version . Actually,
I am developing a web application based on JSF technology. I use Eclipse as
I'm developing a file upload with JSF. The application saves three dates about the
Developing a project of mine I realize I have a need for some level

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.