Objective
Writing Java code indirectly within JSP
(JSP Page Directive)

JSP provides 3 basic directives :
1. page
2. include
3. taglib

Syntax :
<%@ directive attribute1=value1 attribute2=value2 ..... %>

Page Directive : This directive defines high level information about page.
import attribute
Specifies the classes and interfaces to be imported in a page.
By default classes and interfaces from the following packages are imported in every JSP page:
- import java.lang.*;
- import javax.servlet.*;
- import javax.servlet.jsp.*;
- import javax.servlet.http.*;

NOTE : Any class created by user in JSP should be stored in a package. This package should be stored within
	webapps\root\web-inf\classes\<Your Package>
If classes folder does not exists create it in lower case and restart the server

<%@ page import="java.util.*,coreservlets.*" %>

To create a Package within NetBeans
1. File | New File
Categories : Java
File Types : Java Package
- Click on Next
2. Specify the name and Parent Package
- Click on Finish

To create a Packaged class within NetBeans
1. File | New File
Categoires : Java
File Types : Java Class
- Click on Next
2. Specify the name and Package
- Click on Finish


Example : jsp\class3\
	ImportAttribute.jsp
	uses : CookieUtilities.java and 	LongLivedCookie.java





contentType attribute:
This attribute specifies the MIME type of the JSP page
<%@ page contentType="application/vnd.ms-excel" %>

contentEncoding attribute:
This attribute specifies the content encoding being used.
<%@ page contentEncoding="gzip" %>

Example : jsp\class3\
	Excel.jsp
	ApplesAndOranges.jsp







The errorPage and isErrorPage attribute

errorPage attribute specifies the name of the jsp page that will be called in case of Runtime Errors

In the jsp page that handles errors of another page isErrorPage should be set to true, default is false.

In Abc.jsp
<%@page errorPage="Xyz.jsp" %>

Within Xyz.jsp
<%@page isErrorPage="true" %>

A predefined object of Exception class named "exception" carries the error details

Example : jsp\class3\
ComputeSpeed.jsp in case of error calls SpeedErrors.jsp


http://localhost:8080/ComputeSpeed.jsp?furlongs=1000&fortnights=100


The info attribute
Specifies some information about the JSP page. This information can be retrieved using getServletInfo().
<%@page info="Some Information" %>

The language attribute
This attribute specifies the scripting language being used.
Java is the default and the only choice
<%@page language="Java" %>

The extends attribute
This attribute specifies the name of the base class that will be used by servlet on translation of JSP page.
<%@page extends="MyBase" %>

The buffer and autoflush attribute
buffer attribute specifies the size of the buffer being used. This size should be less than 8 k.b. To clear the contents of buffer we call flushBuffer() method from respone.

<%@page buffer="2kb" %>

To flush buffer
<%
response.flushBuffer();
%>

autoflush attribute specifies that the buffers should be flushed automatically
<%@page autoflush="true" %>

The isThreadSafe attribute
This attribute if set to true (default allows) won't allow concurrent access to the servlet
<%@page isThreadSafe="true" %>
