Configure session timeout for JSF managed bean

Posted on 2010-01-03
Last Modified: 2013-11-24

I am a newbie to JSF. I had created a managed bean, and made its scope as session. It works well, and I am able to retrieve all the values stored in that managed bean. However, I dont know how to control the session timeout. Basically, I have two related questions:

1. Could you please help in setting up a timeout for a session? For e.g., is it possible to set the session timeout for the managed bean as 30 minutes?

2. Also, the cookie which maintains the JSF session id expires the moment browser is closed. Is it possible to have the cookie expiry set to the same timeout as set for the corresponding session? This way no matter whether the browser is closed or not, the cookie will live as per its timeout/expiry.

Question by:vi_srikanth
    LVL 20

    Accepted Solution

    LVL 20

    Assisted Solution

    For the second issue I am nit sure of the solution but try using the cookie.setMasAge() method. That looks promising.
    LVL 20

    Expert Comment

    by:Sathish David Kumar N
    LVL 4

    Author Closing Comment

    Thanks for the replies. I am particularly interested in the second question. Anyway I hope that as per the suggestion above, the cookie.maxAge() might work. I will try out that.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now