JSP Thread Safe is used to send only one client request for processing. It is used to implement Single Thread Model interface.
Understand with Example
In this section, you will learn how to use the thread safe attribute. The page directive defines an attribute 'isThreadSafe' whose value is either true or false. If the value is set to true which is a default value, the JSP container can send multiple concurrent client requests to the JSP page by starting a new thread. If the value of this attribute is set to false, then the JSP container sends client requests only one at a time to the JSP page which makes the jsp page safe.
Syntax of isThreadSafe attribute is: <%@ page isThreadSafe="true|false" %>
Here is the code of threadSafe.jsp
|<%@page isThreadSafe="false" %>
<head><title>Jsp Thread Safe</title></head>
<h2> Jsp Thread Safe </h2>
By using the tag <<b>isThreadSafe="false"</b>>, you can make a jsp page safe.
Output will be displayed as:
Posted on: February 3, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles