Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
248
Chapter 11 The JSP page Directive: Structuring Generated Servlets
markup tags; it is discussed in Chapter 14 (Creating Custom JSP Tag Librar 
ies).
The 
page
 directive lets you define one or more of the following case sen 
sitive attributes: 
import
, 
contentType
, 
isThreadSafe
, 
session
, 
buffer
,
autoflush
, 
extends
, 
info
, 
errorPage
, 
isErrorPage
, and 
language
.
These attributes are explained in the following sections.
11.1 The import Attribute
The 
import
 attribute of the 
page
 directive lets you specify the packages that
should be imported by the servlet into which the JSP page gets translated. If
you don't explicitly specify any classes to import, the servlet imports
java.lang.*
, 
javax.servlet.*
, 
javax.servlet.jsp.*
, 
javax.serv 
let.http.*
, and possibly some number of server specific entries. Never
write JSP code that relies on any server specific classes being imported auto 
matically. Use of the 
import
 attribute takes one of the following two forms:
<%@ page import="package.class" %>
<%@ page import="package.class1,...,package.classN" %>
For example, the following directive signifies that all classes in the
java.util
 package should be available to use without explicit package iden 
tifiers.
     <%@ page import="java.util.*" %>
The 
import
 attribute is the only 
page
 attribute that is allowed to appear
multiple times within the same document. Although 
page
 directives can
appear anywhere within the document, it is traditional to place 
import
 state 
ments either near the top of the document or just before the first place that
the referenced package is used.
Directories for Custom Classes
If you import classes that are not in any of the standard 
java
 or
javax.servlet
 packages, you need to be sure that those classes have been
properly installed on your server. In particular, most servers that support
automatic servlet reloading do not permit classes that are in the auto reload 
ing directories to be referenced by JSP pages. The particular locations used
for servlet classes vary from server to server, so you should consult your
server's documentation for definitive guidance. The locations used by Apache
Tomcat 3.0, the JSWDK 1.0.1, and the Java Web Server 2.0 are summarized
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved