File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Invalidate session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Invalidate session" Watch "Invalidate session" New topic

Invalidate session

Dhara Bhatt

Joined: Apr 26, 2006
Posts: 3

I am working on web application using struts, JSP technology. Anybody can help on the following?

1. In my web application, I have logout button. When user will click on logout button, session is going to be invalidated. Related that, I have one field by name 'SITACD' into Database.
2. Default value of 'SITACD' field is '0'.
3. When user will login into application, I am making that field's value 'SITACD=1' to keep track, whether user has been logged in or not.

4. If ohther user will try to login by same id, then firt I m checking, whether 'SITACD' value is 1, if it's 1, then should not allow to login by same id.

5. When user will click on 'logout' button, this field's value will become '0' again.

Problem : If user will dierectely close browser, session will be automatically expired. But how to set this field 'SITACD' 's value to '0'.

How to identify, if session is expired by closing the window directely.

If anybody can help me in this, it would be very helpful to me.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Closing the window does not expire the session, so you can't detect that.

With a session listener you can determine when the orphaned session times out.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Invalidate session
jQuery in Action, 3rd edition