Session Tracking Mechanism in Java

By | August 16, 2011
Session Tracking Concept in Java. Session Tracking in Servlet, JSP and you can find Session Tracking Mechanism in Java.

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
  1. HttpSession
  2. Cookies
  3. URL rewriting
  4. Hidden <form> fields

One thought on “Session Tracking Mechanism in Java

  1. Vijay

    Hi,

    This post is really useful one. I came to know about the answer for four type of Session Tracking Mechanism in Java.

    Thanks.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *