HTTP is a stateless protocol – All by itself, a request will not tell the server which client is making the request.
- When it gets a page request, it has no memory of any previous requests from the same client. This treats as different user.
- In some cases, a Servlet may want to know the specific client that asks for a service.
- When a Servlet that takes care of an online shopping site gets a request for adding an item to the shopping cart, it should know which client is asking for the item.
- Putting things one at a time into a shopping cart, then checking out each page request must be associated with previous requests.
- From the time of accessing any one page in the application, till logging out, we may want to know the requests made by a client.
There are several ways in which a web server can track sessions
- HttpSession
- Cookies
- URL rewriting
- Hidden <form> fields
Hi,
This post is really useful one. I came to know about the answer for four type of Session Tracking Mechanism in Java.
Thanks.