Class 2 |
Intermediate Java 30-IT-397 |
|
Session Tracking
-
HTTP connections are not persistent, meaning that the user is anonymous
from request to request.
-
But most applications require some type of persistence, so we have to associate
some type of unique ID to the user that can be used from request to request.
-
We can do this a few ways:
-
Cookies are text data written to the user's hard drive. These cookies
can contain a unique identifier, and an expriation time. But, cookies
can be disabled.
-
URL Rewriting means we put the key in the query string (parameter list)
of the URL. Thus, we write URLs, such as links and actions for <FORM>
tags, dynamically. But, unlike cookies, this information is not kept
when the browser is closed.
-
Hidden Fields are similiar to URL Rewriting. We just put the unique
ID in a hidden field that is passed through the URL when a form is submitted.
-
Fortunately, Java handles a lot of this for us, if we choose.
-
The HttpSession object automatically handles sessions for us. If the browser
accepts cookies, it will use a cookie. If not, it will use some type
of URL Rewriting.
-
With this, we can acutally pass Java objects across pages.
Cookies, the old fashioned way

Created by: Brandan Jones
December 17, 2001