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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:04:55+00:00 2026-06-06T15:04:55+00:00

In my application I have a quit button, on clicking of which the session

  • 0

In my application I have a quit button, on clicking of which the session for the current user is invalidated by the following piece of the code..

FacesContext.getCurrentInstance().getExternalContext().invalidateSession();

And I redirect the user to a different page.

But now I want if user click on the back button I will take him to the start page of the application instead of the last page visted by him.
I have an application phase listener which sets the page cache related headers to ‘none’, now all I want is to detect that for that user session has been invalidated.
But I guess whenever the user is clicking the back button it is creating a new session for the user. Is there any way to prevent it?

  • 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-06T15:04:56+00:00Added an answer on June 6, 2026 at 3:04 pm

    How to detect session has been invalidated in JSF 2?

    Check if the user has requested a session ID which is not valid.

    HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
    
    if (request.getRequestedSessionId() != null && !request.isRequestedSessionIdValid()) {
        // Session has been invalidated during the previous request.
    }
    

    it is creating a new session for the user. Is there any way to prevent it?

    Just don’t let your application code create the session then. The session will implicitly be created when your application needs to store something in the session, e.g. view or session scoped beans, or the view state of a <h:form>, etc.


    I have an application phase listener which sets the page cache related headers to ‘none’

    A servlet filter is a better place for this. See also Avoid back button on JSF web application

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

Sidebar

Related Questions

In my console application have an abstract Factory class Listener which contains code for
I want to quit application in Android. Just put a quit button, which kills
Currently, I have an application, which will save a temporary screenshot, and let user
I have an UITableView in my application that lets the user quit apps on
I have application which uses Sherlock ActionBar package. The application uses platform-specific behavior for
I have a WPF4 application i have 1 window which editing data : main
So I have my Activity, and on pressing a Quit button I call Activity.finish().
We have a Silverlight application that runs OOB (out of browser) so the user
Especially android-developers :) I have some troubles with application menu which i try to
I am developing an android application in which i have to implement custom rating

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.