This attribute supports a flow maintainer to send multiple and simultaneous requests from a JSP container to a JSP page, if you specify a true attribute value, otherwise if you specify a false attribute value, then the JSP container can send only one request at a time. The default value for the attribute is true.
A threaded JSP / servlet is one that works correctly when more than one thread is running at a time. To make your JSP threads safe, you can implement the SingleThreadModel interface, which prevents two threads from simultaneously accessing the service method.
By default, the servlet container considers the JSP page code safe for reuse in a single instance by multiple request flows. If the page code is subject to inadvertent sharing of its state on simultaneous requests, the following directive will force the servlet container to use separate page instances in each request:
<%@ page isThreadSafe="false" %>
Moreover, instead of a single servlet instance generated for your JSP page loaded into memory, you will have N servlet instances loaded and initialized, with an efficient servicing method for each instance synchronized. You can usually control the number of instances (N) created for all servlets that implement SingleThreadModel through the admin screen for your JSP engine.
Regardless of whether your JSP is thread safe or not, this is a consequence of how you implemented your JSP. When the code in the JSP avoids holding state (such as member and session variables), the servlet container can rely on the default "true" of the isThreadSafe attribute to respond faster and with less memory.
For example, if you use <%! %> <%! %> , this will put the code at the class level, and not in the _jspService method. Representing class members in JSP opens up a way to lose thread safety when using a single instance.
If your JSP is not thread safe since one instance serving concurrent requests, you need to add isThreadSafe=false for everything to work correctly. This will keep the web application flow safe by instructing the servlet container to work with an unsafe JSP thread at a cost:
If isThreadSafe = true, then the JSP container can simultaneously send several outstanding client requests to the page. Authors of pages using true must ensure that they correctly synchronize access to the overall state of the page.
If isThreadSafe = false, then the JSP container should send several outstanding client requests, one in the order in which they were received, to the implementation of the page for processing.
Please note that even if the isThreadSafe attribute is false, the author of the JSP page must ensure that access to any shared objects is correctly synchronized. Objects can be shared either in ServletContext or in HttpSession.