session close in JSP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • megha

    session close 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
  • Herman Timmermans

    #2
    Re: session close in JSP

    megha wrote:
    [color=blue]
    > 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[/color]

    Hi, I already replied to this in your previous thread. Please do not post
    the same question twice under a different heading.
    *************** *************** ***********[color=blue]
    > You should implement the HttpSessionList ener interface. In case a session[/color]
    is invalidated either by a pre-defined time-out or when the user closes his
    browser, the sessionDestroye d 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[color=blue]
    > Megha[/color]

    --
    Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb
    Anti Spam = remove the "dot" and the "at"
    Registered Linux User #264690

    Comment

    • Mladen Adamovic

      #3
      Re: session close in JSP

      took look at the comp.lang.java. database
      already one discussion on the same thema there now
      actual


      "megha" <megha@4cplus.c om> wrote in message
      news:eeb80314.0 312090212.3c424 f6e@posting.goo gle.com...[color=blue]
      > 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[/color]


      Comment

      • megha

        #4
        Re: session close in JSP

        Hi
        I tried to implement httpsessionlist ener 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 HttpSessionList ener {

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

        /* Session Creation Event */
        public void sessionCreated( HttpSessionEven t se) {
        activeSessions+ +;
        System.out.prin tln("activeSess ions90"+activeS essions);
        }

        /* Session Invalidation Event */
        public void sessionDestroye d(HttpSessionEv ent se) {

        System.out.prin tln("activeSess ions");

        }

        public static int getActiveSessio ns() {
        return activeSessions;
        }
        }




        Herman Timmermans <timmermansdot. hermanat@skynet .be> wrote in message news:<3fd5a37d$ 0$2857$ba620e4c @reader1.news.s kynet.be>...[color=blue]
        > megha wrote:
        >[color=green]
        > > 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[/color]
        >
        > Hi, I already replied to this in your previous thread. Please do not post
        > the same question twice under a different heading.
        > *************** *************** ***********[color=green]
        > > You should implement the HttpSessionList ener interface. In case a session[/color]
        > is invalidated either by a pre-defined time-out or when the user closes his
        > browser, the sessionDestroye d 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[color=green]
        > > Megha[/color][/color]

        Comment

        • Fran

          #5
          Re: session close in JSP

          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" <megha@4cplus.c om> escribió en el mensaje
          news:eeb80314.0 312100417.492e0 ca2@posting.goo gle.com...[color=blue]
          > Hi
          > I tried to implement httpsessionlist ener 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 HttpSessionList ener {
          >
          > private static int activeSessions = 0;
          > static String url="jdbc:odbc: candico";
          >
          > /* Session Creation Event */
          > public void sessionCreated( HttpSessionEven t se) {
          > activeSessions+ +;
          > System.out.prin tln("activeSess ions90"+activeS essions);
          > }
          >
          > /* Session Invalidation Event */
          > public void sessionDestroye d(HttpSessionEv ent se) {
          >
          > System.out.prin tln("activeSess ions");
          >
          > }
          >
          > public static int getActiveSessio ns() {
          > return activeSessions;
          > }
          > }
          >
          >
          >
          >
          > Herman Timmermans <timmermansdot. hermanat@skynet .be> wrote in message[/color]
          news:<3fd5a37d$ 0$2857$ba620e4c @reader1.news.s kynet.be>...[color=blue][color=green]
          > > megha wrote:
          > >[color=darkred]
          > > > 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[/color]
          > >
          > > Hi, I already replied to this in your previous thread. Please do not[/color][/color]
          post[color=blue][color=green]
          > > the same question twice under a different heading.
          > > *************** *************** ***********[color=darkred]
          > > > You should implement the HttpSessionList ener interface. In case a[/color][/color][/color]
          session[color=blue][color=green]
          > > is invalidated either by a pre-defined time-out or when the user closes[/color][/color]
          his[color=blue][color=green]
          > > browser, the sessionDestroye d 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[color=darkred]
          > > > Megha[/color][/color][/color]


          Comment

          Working...