Easy learning with example program codes

Session management and cookies in servlet


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. Cookie.
  2. Hidden form field.
  3. Url rewriting.
  4. HttpSession.

Next Topic: Cookie in servlet with example.
Previous Topic: Servlet Hello World Example using annotation with example.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.


Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki