uses a cookie if the client Web browser supports that, or it can also use URL
rewriting to carry the session ID that is associated with the client.
The data that is stored in the HttpSession object is shared across requests
from the same machine. Therefore, the HttpSession object is also suitable to
store individual session profile data from the client.
The HttpSession object is not persistent data. It is deleted after a time out
period or by the invalidate() method. In order to store data persistently,
WebSphere provides a UserProfile (see Section,  User profile
tracking  on page 140).
The HttpSession description can be found at
More information on session tracking can be found at: state/session tracking.html Using the HttpSession object
To use these session objects, we obtain a session object, get or put values to
this object, and invalidate it if we need to remove the context.
Obtaining a session object
To obtain a session object associated with the client, we use the getSession
method as follows (we assume
is of type HttpServletRequest):
boolean flag=true;
HttpSession session=req.getSession(flag);
This obtains the current valid session associated with this request from the
client. The flag indicates whether a session object should be created if it is
not found.
Getting values from a session object
For example, to get the username value from the session, we use the
getValue method associated with the session object as follows:
String username=(String) session.getValue( username )
Putting values to a session object
We can also set values in the session using the putValue method. In the
following example, we associated the password key with a value of
session.putValue( password , elephant )
Linux Web Hosting with WebSphere, DB2, and Domino



About Services Network Support FAQ Order Contact

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting  Business web hosting division of Vision Web Hosting Inc. All rights reserved