What about the following Q. in SCWCDWhiz?
Q. Which of the following
JSP directives can be used to make the service() method implementation of a JSP threadsafe?
a. <%@ page isThreadSafe="false" %>
b. <%@ page isThreadSafe="true" %>
c. <%@ page isSingleThread = "true" %>
d. <%@ page isSingleThread = "false" %>
I think b. is correct. But they said a. is correct and their explanation is as follows:
"A is the correct choice. By default, the service() method of the JSP page implementation class that services the client request is multithreaded. Thus, it is the responsibility of the JSP page author to ensure that access to shared state is effectively synchronized. There are a couple of different ways to ensure that the service methods are thread-safe. The easy approach is to include the JSP page directive:
<%@ page isThreadSafe="false" %>
This causes the JSP page implementation class to implement the SingleThreadModel interface, resulting in the synchronization of the service method, and having multiple instances of the
servlet to be loaded in memory. "
Please someonr make me clear...
[ August 09, 2002: Message edited by: Nazmul Huda Sarkar ]