It's not a secret anymore!*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JSP - single threaded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JSP - single threaded" Watch "JSP - single threaded" New topic
Author

JSP - single threaded

Sumeet Luthra
Greenhorn

Joined: May 24, 2004
Posts: 1
Servlets can be made single threaded by implementing singleThreadModel , how can a JSP page be made single threaded...
Chris Wagnor
Greenhorn

Joined: May 03, 2004
Posts: 21
See if this makes sense... I got this extract from a .pdf file I have, I can only find this line the nearest to answer your quesion.

The isThreadSafe attribute controls whether or not the servlet that results
from the JSP page will implement the SingleThreadModel interface. Use of
the isThreadSafe attribute takes one of the following two forms:

<%@ page isThreadSafe="true" %> <%!-- Default --%>
<%@ page isThreadSafe="false" %>
Chris Wagnor
Greenhorn

Joined: May 03, 2004
Posts: 21
But read this too...

"It is a common mistake to think that implementing SingleThreadModel makes
JSP thread safe.
This is simply not true.
A web container is free to start more than 1 instance of your JSP page.
If this happens the ThreadSafeModel fails.
With JSP there is no substitute for knowing how to implement a thread
safe web application. "
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3211
    
    6
Well, implementing SingleThreadModel for servlet does make it thread safe as well. so, it's the same as with JSP.

The DEVELOPER is responsible to make servlet or JSP thread safe.

Also, note that starting from 2.4 Servlet API the SingleThreadModel interface is *depricated* and should be avoided (not much use, but posible big problems with performance). This means that DEVELOPER should care of properly threading.

cheers!
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
 
GeeCON Prague 2014
 
subject: JSP - single threaded