Friday, August 23, 2002 04:27 AM
First of all thank you very much for your quick help.
I tried everything, but it didn't help. The static variable is still counted twice. I' ll put the important lines of the code at the end my postig. perhaps someone has an idea, that would help me:
public class mservlet extends HttpServlet implements ServiceListener,SingleThreadModel
static int counter = 0;
public void messageReceived(ServiceEvent evt) throws Exception
counter++; // The counter is incremented
System.out.println(counter); // and prints out the right value
public void doPost(HttpServletRequest req,
throws ServletException, IOException
out.println("Counter:" + counter); // 0 is printed out
as i said before the MessageReceived method is called before the dopost method is called. it's acting as a kind of a service. and when the dopost method is called, not the variable that was raised before is accessed, but a new instance of it. is there a possibility to access the raised variable in my dopost method?
thanks in advance for your help