0

I have a JSP WebApplication created. Sessions are used for some features which needs to be destroyed after closing the browser. While I am testing it in my browser (Mozilla), the session does not destroy . Please Help!

1 Answer 1

1

You can create a service or jsp in which you can invalidate (destroy) the session.

request.getSession().invalidate() 

You can send a call to this service on browser window close event through javascript like

// window.onclose is Not available with Firefox 2 or Safari window.onclose = function(event){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","<your-service-url>",false); xmlhttp.send(); } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.