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 8094569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:49:57+00:00 2026-06-05T20:49:57+00:00

I have a question about session timeouts and JSF 2. I have my exception

  • 0

I have a question about session timeouts and JSF 2. I have my exception handler working exactly the way everyone prefers but I need to pass a value to the login page. For example, I have a typical login URL – http://www.acme.com/?companyId=company14 which in turn presents company14 with their own custom login page (using their logo). After they enter the application and do a bit of work, they read an email or 2. The session times out and a session timeout page is shown instructing the user to click Ok to proceed to the login page. How do I add ?companyId=company14 to the URL? I can hardcode it in the exception handler by using this:

requestMap.put(“companyId”, “company14”);

and then referring to it on the viewExpired.xhtml page:

    <h:panelGrid id="expiredGrid" columns="1">
        <f:facet name="header">
            <h:outputText id="outExpireMsg" value="Your session has expired"/>
        </f:facet>
        <h:outputText id="outReqMessage" value="Reloading the page will require login."/>
        <h:outputText value=""/>
        <h:button id="okButton" type="submit" value="Ok" outcome="login?companyId=#{companyId}"/>
    </h:panelGrid>

The issue is I can’t seem to save the companyId anywhere without it getting wiped out by the session timeout. I’d like to set the companyId in the exceptionhandler using this value. Any ideas?

  • 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-05T20:49:59+00:00Added an answer on June 5, 2026 at 8:49 pm

    You could set it as a cookie on login.

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put("path", "/"); 
    externalContext.addResponseCookie("companyId", companyId, properties);
    

    Then you can grab it as follows:

    Cookie cookie = (Cookie) externalContext.getRequestCookieMap().get("companyId");
    
    if (cookie != null) {
        String companyId = cookie.getValue();
    }
    

    Note that this doesn’t expire when the server side session expires. This expires only when the browser get closed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about using session, or maybe TempData to store data while
I have a question about generic collections in C#. If I need to store
everyone! i have a question about sessions hopefully someone can help me with. I
I have a strange question about session management. I implemented a form chain and
I have a question about PHP sessions. I use a session to keep a
I have a question about optimization, but more on the browser/client side. I am
Sorry to interrupt all of you. I have a question about session. In my
As a quazi-newbie to asp.net, I have a question about session variables. I'm building
I have a question about how to keep the current ASP.net/User's session during the
I have a question about using databases... string node = Session[node].ToString(); SqlConnection dataConnection =

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.