ch3.sharedVariable.error
Class Controller

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by ch3.sharedVariable.error.Controller
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
Controller

public class Controller
extends javax.servlet.http.HttpServlet

An example of a servlet that uses member variables and has a sharing error. If this servlet is executed by separate browsers, within three seconds, both browsers will display the same value for the shared variable, even though both servlets incremented the value.

See Also:
Serialized Form

Field Summary
 int accessCount
           
 
Constructor Summary
Controller()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles the HTTP GET method.
 void incrementSharedVariable()
           
 java.lang.String jspLocation()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accessCount

public int accessCount
Constructor Detail

Controller

public Controller()
Method Detail

jspLocation

public java.lang.String jspLocation()

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
Handles the HTTP GET method.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - servlet request
response - servlet response
Throws:
javax.servlet.ServletException
java.io.IOException

incrementSharedVariable

public void incrementSharedVariable()