File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes session info into db Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "session info into db" Watch "session info into db" New topic
Author

session info into db

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
when user logs in I am inserting user session start date/time in my db. when user clicks logged out then db record is updated but How can I know that user closed the browser/machine or timed out as to update db

Thanks & best regards
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There is no way to know when they've closed their browser but a session listener is a good way to trap the creation and destruction of a session.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Originally posted by Ben Souther:
There is no way to know when they've closed their browser but a session listener is a good way to trap the creation and destruction of a session.


I am very new to servlet and Java. Can you please let me know about the session listener example or any tutorial

Thanks for your prompt reply
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Farakh,
Here's an example.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Originally posted by Jeanne Boyarsky:
Farakh,
Here's an example.


I tried a lot to check this example but every following error appears:

Thanks & best regards

Network Error (tcp_error)

A communication error occurred: "Operation timed out"
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.

For assistance, contact your network support team.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It looks like there are a lot of examples on the web.
http://www.google.com/search?hl=en&q=session+listener+example&btnG=Google+Search

Have you tried any of these?
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Originally posted by Ben Souther:
It looks like there are a lot of examples on the web.
http://www.google.com/search?hl=en&q=session+listener+example&btnG=Google+Search

Have you tried any of these?


Thanks a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session info into db