Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2004, 01:06 AM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to VinodTewthia Send a message via Yahoo to VinodTewthia
Default invalidate the session on closing of browser

hi---

in my web-application i am keeping track of logged users and their current session (without cookies) in some datastructure and remove the corospondig record form this datastructure when user logged off properly, but! when user's browser craches or colse unexpectedly then what is the correct way to invalidate the session instead waiting for time-out of session?

 
Old June 12th, 2007, 07:35 AM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sachin_desai5684
Default

Quote:
quote:Originally posted by VinodTewthia
 hi---

in my web-application i am keeping track of logged users and their current session (without cookies) in some datastructure and remove the corospondig record form this datastructure when user logged off properly, but! when user's browser craches or colse unexpectedly then what is the correct way to invalidate the session instead waiting for time-out of session?

s.g.desai
 
Old June 12th, 2007, 08:19 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

You can do this by setting the session time out in the web.xml; some thing like the one bellow
Code:
<session-config>
<session-timeout>30</session-timeout>
</session-config>
And you can implement onunload() in the jsp page and call a java script method and use iframes to send a request to a servlet which will invalidate the session.

Have a look at the following discussions on this topic.

http://www.theserverside.com/discuss...hread_id=38027
http://forum.java.sun.com/thread.jsp...sageID=2832913
http://www.jguru.com/faq/view.jsp?EID=34927
http://forum.java.sun.com/thread.jsp...hreadID=537660
http://onesearch.sun.com/search/ones...orums&site=dev

Hope it gives you usefull information.

Regards,
Rakesh
 
Old July 14th, 2007, 01:47 AM
Authorized User
 
Join Date: Jul 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When unexpected close of browser happens, onunload may not work. So better to use session-timeout of web.xml.
 
Old July 21st, 2007, 12:12 AM
Authorized User
 
Join Date: Apr 2005
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Unfortunately, there is no other mechanism to invalidate the session other than wait for session timeout when the client crashes.

-eNJay





Similar Threads
Thread Thread Starter Forum Replies Last Post
closing browser prv299 ASP.NET 2.0 Professional 1 June 5th, 2008 09:15 AM
browser closing vamsivaila Pro Java 0 January 3rd, 2007 06:43 AM
Determine method of closing browser chrscote Javascript How-To 2 August 31st, 2006 05:34 AM
Closing browser using a Button MichaelTJ ASP.NET 1.0 and 1.1 Basics 3 December 18th, 2003 02:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.