473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

session end problem in jsp

Hi

I am writing a program in JSP which requires user to log in and as he
logs in database was updated with his status on and till the user does
not sign out no other user with same login and password can enter in
the system. as he signs out database was updated but the problem is if
somehow he forgot to sign out and closed the browser or navigate to
other page or site his information was still on in the database. I
want a solution how to update a database when users forgot to signout
but closed the window or browser.
I am using Apache Tomcat ver 4.1.27 with Jsp and SQLServer7.0

Thanks

Megha
Jul 17 '05 #1
3 6364
megha wrote:
Hi

I am writing a program in JSP which requires user to log in and as he
logs in database was updated with his status on and till the user does
not sign out no other user with same login and password can enter in
the system. as he signs out database was updated but the problem is if
somehow he forgot to sign out and closed the browser or navigate to
other page or site his information was still on in the database. I
want a solution how to update a database when users forgot to signout
but closed the window or browser.
I am using Apache Tomcat ver 4.1.27 with Jsp and SQLServer7.0

Thanks

Megha

You should implement the HttpSessionListener interface. In case a session
is invalidated either by a pre-defined time-out or when the user closes his
browser, the sessionDestroyed method is called. Use this method to
clean-up whatever that needs to be done in your database when the user
forgets to do a proper logoff.
Brgds,
Herman
--
Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb
Anti Spam = remove the "dot" and the "at"
Registered Linux User #264690
Jul 17 '05 #2
Herman Timmermans wrote:
megha wrote:

Hi

I am writing a program in JSP which requires user to log in and as he
logs in database was updated with his status on and till the user does
not sign out no other user with same login and password can enter in
the system. as he signs out database was updated but the problem is if
somehow he forgot to sign out and closed the browser or navigate to
other page or site his information was still on in the database. I
want a solution how to update a database when users forgot to signout
but closed the window or browser.
I am using Apache Tomcat ver 4.1.27 with Jsp and SQLServer7.0

Thanks

Megha


You should implement the HttpSessionListener interface. In case a session
is invalidated either by a pre-defined time-out or when the user closes his
browser, the sessionDestroyed method is called. Use this method to
clean-up whatever that needs to be done in your database when the user
forgets to do a proper logoff.


I would point out that when the user closes his or her browser, the
session is not invalidated. (Assuming the browsers haven't changed.)
So you will still be stuck with the session hanging around until the
server times it out, during which time the user will be locked out of
his or her application!

Ray

Jul 17 '05 #3
Hi

I am not able to bind a session with particular user though I am using
httpsessionlistener interface
I used the following code in destroyed method

login = session.getAttribute("user");

Tell me how I can do it.
Thanks
Megha

Raymond DeCampo <rd******@spam-I-am-not.twcny.rr.com> wrote in message news:<wS*****************@twister.nyroc.rr.com>...
Herman Timmermans wrote:
megha wrote:

Hi

I am writing a program in JSP which requires user to log in and as he
logs in database was updated with his status on and till the user does
not sign out no other user with same login and password can enter in
the system. as he signs out database was updated but the problem is if
somehow he forgot to sign out and closed the browser or navigate to
other page or site his information was still on in the database. I
want a solution how to update a database when users forgot to signout
but closed the window or browser.
I am using Apache Tomcat ver 4.1.27 with Jsp and SQLServer7.0

Thanks

Megha


You should implement the HttpSessionListener interface. In case a session
is invalidated either by a pre-defined time-out or when the user closes his
browser, the sessionDestroyed method is called. Use this method to
clean-up whatever that needs to be done in your database when the user
forgets to do a proper logoff.


I would point out that when the user closes his or her browser, the
session is not invalidated. (Assuming the browsers haven't changed.)
So you will still be stuck with the session hanging around until the
server times it out, during which time the user will be locked out of
his or her application!

Ray

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
1
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
7
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
1
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
5
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.