14. Session management and cookies in servlet


Servlet Hello World Example: Previous                                                        Next: Cookie in Servlet

Session management and cookies in servlet

Session:

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 for completing request response cycle. HTTP is a stateless protocol which means when a new request comes it can’t keep any record or state of previous request of the user. That’s why we need session tracking for maintaining the state of the user.

Way of Session Tracking in servlet:

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

Servlet Hello World Example: Previous                                                        Next: Cookie in Servlet