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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:58:12+00:00 2026-05-13T07:58:12+00:00

My requirement is to notify the user with a popup saying that the user

  • 0

My requirement is to notify the user with a popup saying that the user session is about to time out in x seconds in case user does not perform any activity on the web page.

Addition to this requirement is to decrement the value x seconds dynamically in the popup.

The environment I use is Java EE.

  • 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-05-13T07:58:12+00:00Added an answer on May 13, 2026 at 7:58 am

    Make use of HttpSession#getMaxInactiveInterval() and setTimeout(). There’s no need for Ajax in this particular purpose, unless you want to postpone the timeout on every client activity (polling).

    Basic example:

    <script>
        var secondsBeforeExpire = ${pageContext.session.maxInactiveInterval};
        var timeToDecide = 15; // Give client 15 seconds to choose.
        setTimeout(function() {
            alert('Your session is about to timeout in ' + timeToDecide + ' seconds!')
        }, (secondsBeforeExpire - timeToDecide) * 1000);
    </script>
    

    To decrement the time inside the message magically, then instead of the basic alert() you’ll need an overlay with a div wherein you have control over the content through HTML DOM tree and make use of another setTimeout() on 1 second to change the text dynamically.

    Note that this script has to be served by the JspServlet to get the EL to work. Thus, you need to put the script in the HTML <head> of the JSP page, or if you really want to have all the JS in a separate *.js file, then you need to let the JspServlet handle any *.js requests as well.

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

Sidebar

Related Questions

Requirement : To find out which phone the user is using by parsing the
I currently have a requirement to notify my application user if any fields have
My requirement is to notify group of people if our backup fails. We've got
Requirement : Should update MySQL database with that of MS Sql Server updates which
Requirement is like: I want to take input values from user in frame but
The requirement is that we have a lot of saved searches, and when new
Requirement is to skip field validation conditionally. When user selects add, the form fields
Requirement - Detect tablets using JavaScript I'm not allowed to use any plugin or
Here is a case where a thread is waiting for notify() or a timeout.
Requirement: If there are any exceptions, call a method that re verifies data My

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.