Hi!,

Shopping cart is a classic example of maintaining a converational state for
a client . U can achieve this using HttpSession.

HttpSession defines methods which store these types of data:

  . Standard session properties, such as an identifier for the session, and
the context for the session.
  . Application layer data, accessed using this interface and stored using a
dictionary-like interface

  See Servlet API....

The following code snippet illustrates a HIT COUNTER implementation

 //Get the session object - "request" represents the HTTP servlet request
 HttpSession session = request.getSession(true);

 //Get the session data value - an Integer object is read from
 //the session, incremented, then written back to the session.
 //sessiontest.counter identifies values in the session
 Integer ival = (Integer) session.getValue("sessiontest.counter");
 if (ival==null)
     ival = new Integer(1);
 else
     ival = new Integer(ival.intValue() + 1);
 session.putValue("sessiontest.counter", ival);

Hope it helps

Shiraz

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to