aspose file tools*
The moose likes JSP and the fly likes how can we make JSP single threaded? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how can we make JSP single threaded?" Watch "how can we make JSP single threaded?" New topic
Author

how can we make JSP single threaded?

Priya Mandal
Greenhorn

Joined: Oct 04, 2012
Posts: 2
Would like to know how can we make JSP single threaded?
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

can you please elaborate what do you mean MAKE JSP SINGLE THREADED ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
A much better question would be: how can I make my JSP/servlet/Web app multithread safe? Web apps are inherently multi-threaded, and you should learn to write code that is, too.


Ping & DNS - my free Android networking tools app
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018

You CAN make a JSP singlethreaded like this:

However there are a huge number of reasons why you should NOT go down this path.

I think the best answer to this is to refer to the spec description of this property:
isThreadSafe Note: The Servlet 2.4 speciļ¬cation deprecates SingleThreadModel, which is the most common mechanism for JSP containers to implement isThreadSafe.
Page authors are advised against using isThreadSafe, as the generated Servlet may contain deprecated code.

Indicates the level of thread safety implemented in the page. If false then the JSP container shall dispatch multiple outstanding client requests, one at a time, in the order they were received, to the page implementation for processing.
If true then the JSP container may choose to dispatch multiple outstanding client requests to the page simultaneously.
Page authors using true must ensure that they properly synchronize access to the shared state of the page. Default is true.

Note that even if the isThreadSafe attribute is false the JSP page author must ensure that accesses to any shared objects are properly synchronized., The objects may be shared in either the ServletContext or the HttpSession.





 
 
subject: how can we make JSP single threaded?