0 Replies Latest reply on Aug 19, 2002 11:49 PM by Todd Gould

    JSP variable scoping and Thread safety

    Todd Gould Novice

      Hello:

      I'm trying to clarify my understanding of some variable scoping/thread safety issues in my understanding. My question boils down to the following, under what circumstances in a JSP does one need to worry about synchronizing access to avoid potential threading issues for variables? To be more specifiec, I'm trying to determine if there is a correlation between the JSP construct (for example <%! Declaration %>, <% Scriptlet %> and <%= Expression %>) and any variables declared within that contruct and whether it needs to have access synchronized for it? For example, I would assume that any variable declared in the <%! Declaration %> contruct will result in a static variable in the resulting servlet and hence will need to be synchronized to ensure safe access with multiple threads. Is this true? Are there similar rules/guidelines for the other JSP constructs? Of course, I'm assuming more than read only access to said variables for these questions. I'd appreciate any and all assistance/clarification.

      Thanks,

      Todd