Java

Page Directive

Aug 10, 2016

a)Page Directive
 
-This tag is always given above tag.
-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.
 

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".

Related Posts

language_img
Java

JSP Lifecycle

Aug 10, 2016

language_img
Java

JSP Architecture

Aug 10, 2016

language_img
Java

Serverlets V/S Java

Aug 10, 2016

language_img
Java

WHY JSP?

Aug 10, 2016

Table Of Contents

;