ProAnswers.org

Does JSP support multi-threading?

Java Server Pages documents are ultimately compiled to servlets, which are multi-threaded by default and are assumed to be thread-safe. If the code in your JSP is not thread-safe, you can request the container uses a single threaded execution of the resulting servlet using the isThreadSafe page directive:

             @ page isThreadSafe="false" %>
 

In this case the container may create multiple instances of the JSP servlet to handle concurrent requests, or use synchronization to control access to a single instance. Both approaches are likely to reduce the performance of the page because of the overheads of instantiation and locking respectively, so this directive should be used with caution.