This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JSP page directive isThreadSafe 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 page directive isThreadSafe" Watch "JSP page directive isThreadSafe" New topic
Author

JSP page directive isThreadSafe

Eric Benoit
Greenhorn

Joined: Apr 11, 2002
Posts: 13
Hi,
I don't understand the reason why we have to set the page directive isThreadSafe to false if we want the service method to be thread safe.
I thought that we have to set it to true...
Someone can explain it to me?
Thanks.
Eric


Eric Benoit<br /> <br />SCJP 1.4<br />SCWCD 1.3<br />SCBCD 1.3 (in progress)
raj banyal
Greenhorn

Joined: Feb 24, 2003
Posts: 6
It's bit logical....isThreadSafe is the attribute and if it's set to false that means it's not thread safe. And if it's set to true that means it's thread safe.
Cheers
RajSB
SCJP1.4,SCWCD1.3
Eric Benoit
Greenhorn

Joined: Apr 11, 2002
Posts: 13
It's what I thought too..
But in Whizlabs, it says that if we set it to FALSE, the service() method will be THREAD SAFE...
It's not logical this way.
So is it Whizlabs who's wrong or what?
Vijay Sargunam
Greenhorn

Joined: Jan 14, 2004
Posts: 11
Hello Eric,
The logic of using isThread safe is a bit tricky. What it means actually is, when I mark a jsp page with "isThread=true", I say to the container that, "I have developed my jsp in a thread safe manner, so you dont have to worry about it(by implementing the SingleThread interface)". However, if you say "isThread=false", the container steps in and implements the SingleThreadModel for your jsp and thus tries to make it thread safe. I hope this helps.
Regards,
Vijay
 
GeeCON Prague 2014
 
subject: JSP page directive isThreadSafe