Wednesday, September 28, 2005

Why do u use Session Tracking in HttpServlet ?

The HTTP protocol uses stateless connections. The client browser makes a connection to the server, sends the request, gets the response and closes the connection. In other words the connection exists only for a single request/response.

Because the session doesn’t persist, the container doesn’t recognize that client making a second request is the same client from a previous request. As for as the container is concerned each request is from a new client.

Hence to maintain a conversational state across multiple requests from the same client we use HttpSession Objects for Session Tracking.

From Spec

SRV.7.1.1 Cookies
Session tracking through HTTP cookies is the most used session tracking mechanism and is required to be supported by all servlet containers.


Post a Comment

<< Home