Bright Java Tutorial

JSP

JSP Directive To Import Classes

When you are writing your Java Server Pages,
there will be a time when you need to use classes
that are available in your class path. For example,
you wish to print the current date. How will you do this?
Lets take a look at an example using purely JSP scriptlets.

Let me read your mind. Most likely, you are now asking the
question "Why don't we use the import statement just like
we did in Java programming?". You cannot simply insert
a line of code that says 'import java.util.Date;' at the
very first line between your <% and %>. This is where
JSP Page Directive will come into play. Let us look at the revised
version of the above code.