I am using the page directive to set the page to threadsafe i.e.
I am assuming that if more than two threads (i.e. if this page is requested by more than two clients) at the same time, the page will throw an exception.
But my page is does not do anything (no exceptions) if more than two clients access it.
"Thread safe" means it is safe for more than one thread to access the JSP at a time. So I can't imagine why you would expect an exception to occur if more than one thread accesses the JSP at the same time. Basically, your assumption doesn't make any sense.
Gopikrishna Madishetti
Greenhorn
Joined: Sep 30, 2008
Posts: 10
posted
0
isThreadSafe attribute -- this support the facility of maintaining thread for sending multiple and concurrent requests from the JSP container to the JSP page if you specify the true value of the attribute otherwise if you specify the false value of the attribute then the JSP container can send only one request at one time.
Ashimashi Kabashi
Ranch Hand
Joined: Sep 11, 2006
Posts: 84
posted
0
hmm..
So I am guessing is.. how is the page ThreadSafe? does the isThreadSafe method make the PAGE threadsafe?
I mean.. how can I see the utility of this directive?
Of course, just saying that a class is thread safe doesn't make it thread safe. However, if you declare that your JSP is not thread safe, then the container will believe you and not let two threads use it at the same time. And if you declare that it is thread safe, then the container will allow more than one thread to use it at the same time. In this case, bad things may happen if it is really not thread safe.
However, writing JSP code which is not thread safe is a bad practice anyway, so there should be no point in ever using this attribute. The question is purely theoretical.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.