On 1:59 PM, Christopher Schultz wrote: > Aitor, > > On 12/15/11 7:12 AM, Aitor Garcia | Tempel.es wrote: > > 5) Tomcat, creates ONE (or maybe SOME) Class object and call to the > > _jspService on every script request > > > What happens if you handle Pool Coonections with a > > 'java.sql.Connection conn' variable declared into the definitions > > block "<%! %>"? > > > Happens than if you are donig multitheading and executing the same > > sctipt in parallel you will mix up connections because evey thead > > is executing the same method in parallel and putting a different > > connection into the java.sql.Connection conn class variable. > > > I don't know if this is a tomcat bug. > > Obviously it's not. > > This is one of the many reasons why application logic has no business > being in a JSP. Whoever proposed (and, indeed approved) the > introduction of scriptlets (<% ... %>) should have been flogged. > > -chris
Hi, Aitor- Tomcat reuses JSP class instances in multiple threads. Variables defined in declarations blocks <%! ... %> result in member (or instance) variables. If you define instance variables, you have to ensure their usage is thread-safe. Variables defined in scriptlet blocks <% ... %> result in variables that are local to the JSP service method. -Terence Bandoian --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org