Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Cookies and session tracking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cookies and session tracking" Watch "Cookies and session tracking" New topic
Author

Cookies and session tracking

Raj Jindal
Ranch Hand

Joined: Jan 17, 2003
Posts: 50
Do cookies keeps track of the session ?
OR
They help in keeping track of the session information ?
Paul Kelcey
Ranch Hand

Joined: Jan 26, 2003
Posts: 45
I'm no expert but I understand that modern web-containers automatically handle session tracking for you using either cookies or URL rewriting. I think it depends on the client. If the client accepts cookies, then the web-container uses cookies, otherwise it uses URL rewriting.
As a developer you don't really need to be too concerned about how the web-container does it. The web-container provides a HttpSession object for you to use to store information for a particular user. I think this is what you're talking about when you say "session information"?
The web-container knows what HttpSession object to associate with a request using either one of these session tracking methods. You just need to use the HttpSession object to store and retrieve information when you're processing a request.
The typical example is a shopping cart. You would just use the HttpSession object to store shopping items in it. When they wanted to check out, you'd retrieve all of the shopping items from the HttpSession object.
It wasn't always this way however and previously you had to do it yourself. Nowadays however the web-container will take care of it for you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cookies and session tracking
 
Similar Threads
how to track an url when a user clicks on it using cookies
cookies
Is there any way to track session without session object,Cookies,Hidden fields and URL rewriting?
Cookies
Session counter: ok Mozilla, !ok in IE