File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

JSP page directive isThreadSafe

Eric Benoit

Joined: Apr 11, 2002
Posts: 13
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?

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

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.
Eric Benoit

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

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.
I agree. Here's the link:
subject: JSP page directive isThreadSafe
It's not a secret anymore!