All Examples  This Package

Class examples.servlets.SessionServlet


public class SessionServlet
extends HttpServlet
This is a simple example of an HTTP Servlet that uses the HttpSession class to track the number of times that a client has visited the servlet. Using session tracking provides an alternative method for tracking a client and storing client specific data, when the client browser does not support cookies. This is achieved by encoding a tracking id into the URLs linked in the pages that are returned to the client.
In order to gaurentee that session response headers are set correctly, the session must be retrieved before any output is sent to the client.

Ensure that session tracking via URLRewriting is turned on in your file, if you wish to test this example with cookies turned off in your browser.

Constructor Index

 o SessionServlet()

Method Index

 o doGet(HttpServletRequest, HttpServletResponse)
 o getServletInfo()


 o SessionServlet
 public SessionServlet()


 o doGet
 public void doGet(HttpServletRequest req,
                   HttpServletResponse res) throws ServletException, IOException
doGet in class HttpServlet
 o getServletInfo
 public String getServletInfo()
getServletInfo in class GenericServlet

All Examples  This Package