What is session?
A session is a link between a client and the server. This link represents some identity that makes client unique so that it is known by the server whenever a request is made.
Need to maintain this session?
Whenever a client made a request, the server treats it as a new request. In some applications we require that a series of requests made by a client will associate with one another. So we need to maintain the state of a user.
How to maintain a session?
To maintain a session, servlet container uses various methods to make a particular client unique so that server can easily identify it.
Different ways to maintain session
There are several ways in servlet to maintain session:
- Hidden Form Field
- URL Rewritting