    All Examples  This Package

# Class examples.servlets.SessionServlet

    java.lang.Object
       |
       +----javax.servlet.GenericServlet
               |
               +----javax.servlet.http.HttpServlet
                       |
                       +----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.

Note:

> 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 weblogic.properties file, if you wish to test this example with cookies turned off in your browser.

##

SessionServlet()

##

doGet(HttpServletRequest, HttpServletResponse)
getServletInfo()

##

SessionServlet

     public SessionServlet()

##

doGet

     public void doGet(HttpServletRequest req,
                       HttpServletResponse res) throws ServletException, IOException

  Overrides:
    doGet in class HttpServlet

getServletInfo

     public String getServletInfo()

  Overrides:
    getServletInfo in class GenericServlet

    All Examples  This Package