a)Page Directive
-This tag is always given above tag.
-Controls resultant translated page.
-No output.
Syntax:
<%@ page attribute="value" attribute="value" %>
-Controls resultant translated page.
-No output.
Syntax:
<%@ page attribute="value" attribute="value" %>
Attribute of page directive.
i) language
-By default java is used.
<%@ page language="Java" %>
-It is used for future consideration, where JSP might support language other than java.
-By default java is used.
<%@ page language="Java" %>
-It is used for future consideration, where JSP might support language other than java.
ii) import
-import package required by this JSP page.
-This is the only attribute which can be repeated more than once.
<%@ page language="Java" import="java.util.*" import="java.sql.*" %>
OR
<%@ page language="Java" import="java.util.*, java.sql.*" %>
iii) buffer-JSP does not uses PrintWriter, but uses JSPWriter.
-Buffer can be "none","8 kb","12 kb" as per requirement.
<%@page buffer="15 kb" %>
iv) autoflush-Defines whether the buffered output is flushed automatically.
-Default value is true.
-If false is passed, an IOException is generated.
<%@ page autoflush="true" %>
v)isErrorPage -Defines whether current page represent JSP error page.
-Default value is "false",but if it's change to true,page has access to implicit exception object.
<%@ page isErrorPage="true" %>
vi) errorPage-Defines the URL to which Exception should be sent.
-The target JSP's isErrorPage value should be true.
<%@ page errorPage="MyExceptionPage.jsp" %>
vii) session-Defines whether page will have implicit session object.
-Default value is "true".
<%@ page session="true" %>
equivalent to getSession(true);
<%@ page session="false" %>
equivalent to getSession(false);
viii) isThreadSafe-Defines whether the generated servlet need to implement the SingleThreadModel.
-Default value is "true".