Forums Register Login
about servlet variable
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HolisticCounter extends HttpServlet {

static int classCount = 0; // shared by all instances
int count = 0; // separate for each servlet
static Hashtable instances = new Hashtable(); // also shared

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
PrintWriter out = res.getWriter();

out.println("Since loading, this servlet instance has been accessed " +
count + " times.");

// Keep track of the instance count by putting a reference to this
// instance in a hashtable. Duplicate entries are ignored.
// The size() method returns the number of unique instances stored.
instances.put(this, this);
out.println("There are currently " +
instances.size() + " instances.");

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

can anyonn expalin the result
Please read this.
At first glance I would say you got bit by one of the invoker servlet traps. Read the Invoker servlet FAQ here at the ranch
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

This thread has been viewed 434 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jun 20, 2018 02:01:32.