accessing class and static variables in servlet class
843841Jun 11 2003 — edited Jun 12 2003I haven't used servlets much before so I'm hoping all you smart folks out there can help me clear up a few things :-)
I have a servlet that has a bunch of class variables (they are declared outside of the doGet and doPost methods). I notice that if I invoke the servlet once, which causes it to assign some values to those variables, and then invoke it again shortly after, the values which were assigned the first time carry over. I'm confused now. Does this mean that there will be a concurrency problem if someone else on another machine is invoking the servlet at the same time that I'm invoking it?
Another related question: If I have a static class variable and assigned it some value, would every instance of the servlet, even those started by a person using another machine, be able to access that value?
Sorry if the questions are dumb. I would really appreciate any clarifications. Thanks a lot.