Can a JSP be multi-threaded?

Govind Seshadri

By default, the service() methods of all JSP pages execute in a multithreaded fashion. Each client request is dispatched in a concurrent manner within a separate thread by the servlet engine. Thus, it is important to synchronize access to any page shared state in the default scenario.

You can make a page "thread-safe" and have it serve client requests in a single-threaded fashion by setting the page tag's isThreadSafe attribute to false:

<%@ page isThreadSafe="false" %>

This causes the generated servlet to implement the SingleThreadModel interface.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact