Session management in servlet

Session:

The session is a time interval devoted to an activity.

Session Tracking:

Session Tracking or session management is a way of maintaining the state of the user.

Need of Session Tracking:

As we discussed in earlier tutorials we are using HTTP to complete request-response cycle. HTTP is a stateless protocol which means when a new request comes it can’t keep any record or state of the previous request of the user. That’s why we need session tracking to maintain the state of the user.

Way of Session Tracking in servlet:

  1. Cookie.
  2. Hidden form field.
  3. Url rewriting.
  4. HttpSession.