Esempio n. 1
0
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    count++;
    out.println(
        "<h1>Since loading, this servlet instance has been accessed " + count + " times.</h1>");
    instances.put(this, this);
    out.println("<h2>There are currently " + instances.size() + " instances.</h2>");

    classCount++;
    out.println(
        "<h3>Across all instances, this servlet class has been accessed "
            + classCount
            + " times.</h3>");
  }