-> 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)? -> Whenever the servlet is recompiled (for example after you change the jsp page). Otherwise, count is initialized once, and incremented by each visitor and each time the user reloads the page. Restarting the server will also reinitialize. +----------------------------+------------------------------+ | Harry J. Foxwell | VoiceMail: 703-204-4213 | | Area System Engineer for | FAX : 703-208-5858 | | Java & Network Computing | | | Sun Microsystems | | | 7900 Westpark Drive | | | Suite A110 | Email: | | McLean, VA 22102-4203 | [EMAIL PROTECTED] | +----------------------------+------------------------------+ | Internet Web Page: http://mason.gmu.edu/~hfoxwell/ | +-----------------------------------------------------------+ =========================================================================== 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
Re: Lifetime-of-a-variable question (newbie)
Harry Foxwell - SE Sun McLean VA Tue, 30 May 2000 07:14:07 -0700
- Lifetime-of-a-variable question (newbie) Barry Burd
- Re: Lifetime-of-a-variable question ... Pradeep Kumar
- Harry Foxwell - SE Sun McLean VA