Example & Tutorial understanding programming in easy ways.

Is JSP variable declaration thread safe?

No. The declaration of variables in JSP is not thread-safe, because the declared variables end up in the generated Servlet as an instance variable, not within the body of the _jspservice() method.
 The following declaration is not thread safe: because these are declarations, and will only be evaluated once when the page is loaded
 <%! int a = 6 %>
 The following declaration is thread safe: because the variables declared inside the scriplets have the local scope and not shared.
 <% int a = 6 %>;

Read More →