No, there can be multiple instances of a servlet. Check your application
server.

-----Original Message-----
From: Barry Burd [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 30, 2000 6:03 PM
To: [EMAIL PROTECTED]
Subject: Lifetime-of-a-variable question (newbie)


In the following JSP code:

  <%! int count = 0; %>
  You are visitor number <%= ++count %>.

under what circumstances will the value of 'count' be reset to zero?
Is it true that the server will create only one instance of the servlet
that's created from this code (and, thus, all visitors will see an
incremented
value of 'count' until the server is stopped and restarted, which is
normally
not done very often)?

Thanks.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to