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

session close 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+
4 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
Hi, I already replied to this in your previous thread. Please do not post
the same question twice under a different heading.
***************************************** 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 Megha


--
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
took look at the comp.lang.java.database
already one discussion on the same thema there now
actual
"megha" <me***@4cplus.com> wrote in message
news:ee**************************@posting.google.c om...
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 #3

P: n/a
Hi
I tried to implement httpsessionlistener interface but it is not
activating
destroy method once the user closes the browser window though it is
properly running the create method. I am using the following code and
in destroy method it has to display only text but it is not. Please
send some suggestion.

public class SessionCounter implements HttpSessionListener {

private static int activeSessions = 0;
static String url="jdbc:odbc:candico";

/* Session Creation Event */
public void sessionCreated(HttpSessionEvent se) {
activeSessions++;
System.out.println("activeSessions90"+activeSessio ns);
}

/* Session Invalidation Event */
public void sessionDestroyed(HttpSessionEvent se) {

System.out.println("activeSessions");

}

public static int getActiveSessions() {
return activeSessions;
}
}


Herman Timmermans <ti********************@skynet.be> wrote in message news:<3f**********************@reader1.news.skynet .be>...
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


Hi, I already replied to this in your previous thread. Please do not post
the same question twice under a different heading.
*****************************************
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
Megha

Jul 17 '05 #4

P: n/a
you must include <session-timeout> in your web-xml. In other cases the
session never expires.

you could test with value=1 (one minute) to test.

bye
"megha" <me***@4cplus.com> escribió en el mensaje
news:ee**************************@posting.google.c om...
Hi
I tried to implement httpsessionlistener interface but it is not
activating
destroy method once the user closes the browser window though it is
properly running the create method. I am using the following code and
in destroy method it has to display only text but it is not. Please
send some suggestion.

public class SessionCounter implements HttpSessionListener {

private static int activeSessions = 0;
static String url="jdbc:odbc:candico";

/* Session Creation Event */
public void sessionCreated(HttpSessionEvent se) {
activeSessions++;
System.out.println("activeSessions90"+activeSessio ns);
}

/* Session Invalidation Event */
public void sessionDestroyed(HttpSessionEvent se) {

System.out.println("activeSessions");

}

public static int getActiveSessions() {
return activeSessions;
}
}


Herman Timmermans <ti********************@skynet.be> wrote in message

news:<3f**********************@reader1.news.skynet .be>...
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


Hi, I already replied to this in your previous thread. Please do not post the same question twice under a different heading.
*****************************************
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
Megha

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.