By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,538 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,538 IT Pros & Developers. It's quick & easy.

session end problem in jsp

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.