what is session in servlet

What is session tracking

To manage clients previous request data at the time of processing later request and to provide separation between multiple users we need a set of mechanism explicitly at server side called Session tracking

Why Session Tracking ?

As we know that HTTP protocol is a stateless protocol, means all request and responses are independent to each other and each request is considered as the new request so we need to maintain state using session tracking techniques.

Server treats all coming request as the new request.So we need to maintain the state of an user to recognize particular user.

What is session in Servlet

Session is a time duration which starts from the starting point of client conversation with server and will terminate at the ending point of client conversation with the server.

What is state of session?

The data which we transfer from client to server through multiple number of request during a particular session then that data is called state of the session.

Ways to implement session in Servlet

  1. HttpSession
  2. Coockie session
  3. URL-Rewriting session
  4. Hidden Form session


We can save a unique identification about any user in a object which are available throughout our application until it destroyed.

So where ever the user goes we will always have his information and we can always manage which is doing what through session in java.

Full-stack web and mobile app development company Contact Us : Skype: indore.webcoder Email: info@w3sparks.com Sales: +91 8085506229