2 Minutes To Code (β Version)

Java Servlets - 2 minute tutorial

Introduction to HttpSession

Http is a stateless protocol. What this means is that the protocol itself does not provide any mechanism to the http server to map an http client making a new http request to the http requests that he has made earlier.

The servlet specification however introduced the concept of session (HttpSession object), in which by means of cookies or url rewriting or hidden parameters, this conversation state(with knowledge of past http requests) is maintained.

Let's see how to use session in the next few examples.