Different servers may import additional classes, but the preceding list of classes is required to have a functioning JSP environment. You should not rely on your JSP pages having access to classes other than the ones listed without importing the classes yourself! Wouldn t you be embarrassed if your carefully coded JSP pages executed perfectly on server A but choked big time when the company switched to server B, a different Java-enabled server? The following example allows you to code unqualified references in a JSP page for classes in somePackage: <%@ page import="somePackage.*" %> The import attribute is the only attribute that may be coded multiple times in a JSP. Be advised that different Web servers use different directory structures. Therefore, in all likelihood, server A may force you to store your custom classes in a different directory than server B. Some servers require that you store classes used by your JSP pages in a different directory than the directory used to store custom classes for your servlets. The moral of the story is that a cursory glance at the server documentation is worth an hour of directory code examination and trial and error. The info Attribute The info attribute enables you to make a string available to your JSP pages by invoking the JSP page implementation of the Servlet.getServletInfo() method. The string can be pretty much anything you desire. The following is a coding example: <%@ page info="This JSP Page Written By Lou Marco" %> The isThreadSafe Attribute The isThreadSafe attribute lets the JSP container know how to dispatch requests to the page. The value of this attribute is a boolean. When the value is false, the JSP container dispatches one request at a time; when the value is true, the JSP container dispatches all outstanding requests simultaneously. Servlets usually create a thread per user request. Multiple requests result in the servlet dispatching multiple threads, each thread accessing the service() method of the same servlet. The underlying assumption is that the servlet is thread safe. The servlet synchronizes access to data so that threads do not “step on” each other. Assigning a value of true to isThreadSafe does not make your code thread safe. The isThreadSafe attribute is merely a statement about your code s ability to handle multiple threads. Although you should write your code to assume correct execution in a multithreaded environment, you may encounter a situation in which a class you need to use is not thread safe. Hence, you may, at times, code a value of false for the isThreadSave attribute. The default value is true.
Try discount web hosting services, our team’s aim is to offer the best possible web hosting services, at the lowest possible price.