Home | | Web Technology | Sessions

Chapter: Web Technology : Host Objects

Sessions

This section shows how to use Session Tracking capabilities

SESSIONS

 

Session Tracking

 

This section shows how to use Session Tracking capabilities

 

Session Tracking allows a Servlet to associate a request with a user. A session can extend across requests and connections of the stateless HYPERLINK "http://www.novocode.com/doc/servlet-essentials/appendix.html#a_d_HTTP" HTTP. Sessions can be maintained in two ways:

 

1.     By using Cookies. A Cookie is a string (in this case that string is the session ID) which is sent to a client to start a session. If the client wants to continue the session it sends back the Cookie with subsequent requests. This is the most common way to implement session tracking.

 

2.     By rewriting URLs. All links and redirections which are created by a Servlet have to be encoded to include the session ID. This is a less elegant solution (both, for Servlet implementors and users) because the session cannot be maintained by requesting a well-known URL oder selecting a URL which was created in a different (or no) session. It also does not allow the use of static pages. All HTML pages which are sent within a session have to be created dynamically.

 

Our next Servlet manages a virtual shopping cart. Users can add various items to their shopping cart via HTML forms. The shopping cart contents are stored on the server and each user gets his own shopping cart which is selected automatically whenever he makes a request to the Servlet.

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Web Technology : Host Objects : Sessions |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.