Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP page directive isThreadSafe

 
Eric Benoit
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
raj banyal
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic