How to end sessions automatically if user closes the browser

前端 未结 6 1334
孤街浪徒
孤街浪徒 2020-12-10 09:12

I need to end the session automatically when the user is inactive for some particular time say for 10 minutes. We have a method in

HttpSession session=reque         


        
6条回答
  •  渐次进展
    2020-12-10 09:44

    Avoid manual code for that.

    simply in web.xml //this will applied for whole application

    
    10
    
    

    Detect browser close event and call invalidate method

    if(session!=null) { 
    session.invalidate();   
    }   
    

提交回复
热议问题