Auto Log Off once the session expires

前端 未结 5 839
不思量自难忘°
不思量自难忘° 2020-12-05 06:10

Our application logs off after 30 min and gets redirected to login page,i am specifying session timeout in web.xml and using a requestProcessor for redirecting.I want to sho

5条回答
  •  长情又很酷
    2020-12-05 06:53

    Include a javascript utility function inside your JSP and ping the server every 31 minutes. The above mentioned utility function should be using setTimeout() JS function internally.

    setTimeout ( "checkServerSession()",  /* intervalInMilliSeconds */ 31000);
    

    Note that

    checkServerSession()

    is a regular JS function which may fire HTTP requests. If the request is successful session exists otherwise show the prompt to the user.

提交回复
热议问题