Is isThreadSafe Needed Here?
No
<%! private int idNum = 0; %>
<%
synchronized(this) {
String userID = "userID" + idNum;
out.println("Your ID is " + userID + ".");
idNum = idNum + 1;
}
%>
Totally safe, better performance in
high traffic environments
45
JSP
www.corewebprogramming.com
Other Attributes of the page
Directive
session
Lets you choose not to participate in sessions
buffer
Changes min size of buffer used by JspWriter
autoflush
Requires developer to explicitly flush buffer
extends
Changes parent class of generated servlet
errorPage
Designates a page to handle unplanned errors
isErrorPage
Stipulates that page can be used as error page
46
JSP
www.corewebprogramming.com
23