HTTP is a Statless
protocol. Maintaining state is kludgy. This protocol was designed to do two things, Process a request (ie get a page) and close the connection. So How does one monitor state in an application? Good question.
There are three standard ways... Luckily Java Servlets provide the HTTPSession API. HTTPSession uses a combonation of cookies and url rewritting to accomplish this task. AND a lot of it is transparent to the user.
- Cookies - Store Session id in a cookie and send it back and forth to the user
- URL Rewriting - append parameters (session id) to the url
- Hidden Form Fields - Like this <input type ="HIDDEN" name="SESSION" Value = "123456" />
Tutorial on HTTPSessions and HTTPSessionListener
Tutorial on HTTPSession Management.