From tomcat-user-return-87712-apmail-jakarta-tomcat-user-archive=jakarta.apache.org@jakarta.apache.org Mon Dec 29 19:05:42 2003 Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 31567 invoked from network); 29 Dec 2003 19:05:42 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 29 Dec 2003 19:05:42 -0000 Received: (qmail 49683 invoked by uid 500); 29 Dec 2003 19:05:14 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 49461 invoked by uid 500); 29 Dec 2003 19:05:13 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 49446 invoked from network); 29 Dec 2003 19:05:12 -0000 Received: from unknown (HELO tsihqexc1.mytravelco.com) (12.8.163.233) by daedalus.apache.org with SMTP; 29 Dec 2003 19:05:12 -0000 Received: by tsihqexc1.mytravelco.com with Internet Mail Service (5.5.2653.19) id ; Mon, 29 Dec 2003 14:03:35 -0500 Message-ID: <87EC26183A29D5118DF1000629399BB70B6F755F@tsihqexc1.mytravelco.com> From: "Hume, John - NA US HQ Delray" To: 'Tomcat Users List' Subject: RE: Thread Safe JSP/Servlets Date: Mon, 29 Dec 2003 14:03:29 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Instance variables in a JSP will be shared among requests, so you could have an issue. Note however, that you have to go out of your way to declare instance variables in a JSP (by putting them in a <%! //declaration block %> rather than a plain old <% //scriptlet block %>). All non-declarative scriptlets and all static page content go into the service method of the JSP, so they're threadsafe. -john. -----Original Message----- From: Merrill Cornish [mailto:merrill.cornish@earthlink.net] Sent: Monday, December 29, 2003 1:55 PM To: tomcat-user@jakarta.apache.org Subject: Thread Safe JSP/Servlets I understand how to write thread-safe software in general, but I suddenly realized that I don't understand what, if anything, Tomcat "shares" among different sessions (i.e., different users accessing the same JSP application) and would therefore be thread sensitive. For example, in my servlets, I have only constant class fields--no instance fields. All user-specific information is stored in session attributes that exist only between user login and logout. However, it finally dawned on me that my JSP pages are quietly being turned into servlets behind my back (this is despite my occassionally referencing the generated *_jsp files while debugging), and those servlets DO have instance fields. My specific question is whether Tomcat keeps the instance fields for JSP servlets separate by session. My more general request is for a pointer to "best practices" documentation on how to keep JSPs and servlets thread safe. Merrill Cornish --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org