Class 2 |
Intermediate Java 30-IT-397 |
|
The import Attribute
-
Import Java packages necessary for your JSP to run. It won't compile
without!
-
A little bit different from the syntax you may be used to, though.
See my previous example.
-
<%@ page import = "java.lang.String" %>
-
not import java.lang.String; as you would see in a normal class.
-
As with a normal import statement, using a * signifies that all classes
of that package should be imported, but this does not include child packages.
-
So, <%@ page import "java.util.*" %> will import the java.util.Hashmap
class, but not java.util.zip.ZipFile.
-
Separate packages by commas, but keep them all within the same quotes.
-
You can put this anywhere in your JSP, and you can use page import
multiple times, but it is good practice to keep the entries near the top
of the page.
- Directories for custom classes
contentType attribute

Created by: Brandan Jones
December 17, 2001