How to clear the httpsession, if the user close the browser in java

前端 未结 5 1723
闹比i
闹比i 2021-01-03 01:51

I am trying to clear the HttpSession if the consumer close the browser window. I dont know how to do it, Please help me anyone

Thanks & Regards Chakri

5条回答
  •  自闭症患者
    2021-01-03 02:42

    Short answer: you can't. Fortunately, sessions expire automatically after a period of time; check your servlet engine documentation to see how to set this timeout period.

    I felt that there should be a way to do it from JavaScript; unfortunately, JavaScript doesn't seem to have an onWindowClose handler.

提交回复
热议问题