Page Directives

This directive holds the information which is required to customise the(JSP) page translation. I.e this hold some instructions which helps the translator wheel translating the page into servlet(.java file).

Standard syntax:<%@page attributes %>
xml Syntax:-

page_directive_attr_list :=
{ language="scriptingLanguage }
{ extends="className" }
{ import="importList" }
{ session="true|false" } // default ➡ true
{ buffer="non|sizekb" } // default ➡ 8kb
{ isErrorPage="true|false" } // default ➡ false
{ errorPage="error_url" } // no default
{ ContentType="text/html" } //resp content type // no default value
{ isThreadSafe="true|false" } // default ➡ true
{ info="info_text" } // no default
{ autoflush="true|false" }// default ➡ true
{ pageEncoding="peinfo" }
{ isELIgnored="true|false" } default ➡ true
{ deferredSyntaxAllowedAsLiteral="true|false" } { trimDirective Whitespaces=""true|False" }


1• Language

Takes the language which is used in the jsp documentation(i.e. scripting tags)

2• import

Takes one or more packages,which are include into the import statement list while the page is being translated.
with import getting system Data.

<%@ page import="java.util.Date" %>Current date of pc:<%=new Date()%>

Output here this Jsp prgram

Importing multiple packages

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

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


This attribute takes the complete qualified class name as value. This class should be the subtype of JSPPage


Takes true/false(default is true)We can use this attribute to make session object unavailable to the jsp.
By default session object is available for every jsp.
If we do not want session object then we have to declaring session attribute as follows:

<%@ page session="false" %>

if we are not declaring session attribute or declaring session attribute explicity with true value.the equal generated servlet code in

_jspService() is
HttpSession session=null; Session=pageContext.getSession();

Because of these two lines session object available to the jsp.
If we are declaring the session attribute explicitly with "false" value,then the above 2 lines code won't be generated and hence session object won't be available to the JSP.
generated and hence session object won't be available to the JSP.


Takes the buffer size like 8kb,16kb,32kb.we can also specify 0kb.


True/false default is true


Value contains the path of the page to which the request to be dispatched when an error is raised in the document.


Takes true/false default is false if this is true then we are available with one implicit object exception of type Throwable
Note:Page directives can be used in the jsp document for any number of times.but the same attributes except import should not be repeated
Page directive must be at the begining of the page(Preceedingtag) « Privious Post » « Next Post » share on :        :  

Love to hear your Views / Guidance / Recommendations on this Post…

Explore the Technology World

Computer Programming Terminologies Computer Programming Terminology is a general word for the group of specialized words or meanings relating to Computer Programming, and also the study of such t ...Read MoreNew features in JDK 12 with IntelliJ IDEADeveloped by JetBrains (formerly known as IntelliJ) ,IntelliJ IDEA is a Java integrated development environment (IDE) for developing computer software. It is av ...Read MoreGoogle Pay API Implementation Demo for AndroidIn this youtube Channel by Android Developers ,Learn how to implement the Google Pay API for Android with just a few lines of code and how it works with your ex ...Read MoreUnit Testing in .NET Core and Azure Devops pipelineUnit testing is a software testing method by which individual units of source code, usage procedures,sets of one or more computer program modules together with ...Read MoreThe mind behind Linux & GIT : Linus TorvaldsLinus Torvalds transformed technology twice — first with the Linux kernel, which helps power the Internet, and again with Git, the source code management ...Read MoreTensorflow and deep learningWith Tensorflow ,deep machine learning transitions from an area of research into mainstream software engineering. ...Read MoreJava program to return all possible permutations from collection of distinct numbersexample of Java program to return all possible permutations from collection of distinct numbers ...Read MoreReal Time Analytics with Spring Application Development FrameworkSpring is the most popular application development framework for enterprise Java.Millions of developers use Spring to build simple, truly portable, fast and fle ...Read MorePath Setting in Java When an application is launched from command prompt Windows OS searches for the executable program in the current working directory. The prompt throws an error ...Read MoreFacebook | whatsapp|Github | Twitter | LinkedIn | Youtube| reddit About | Cookies-Policy | Disclaimer | Site Map | Contact

Call / Visit for New Batch


Why Join Us

  • ➯ Free Demo Classes
  • ➯ No Registration Fee
  • ➯ Interview Questions
  • ➯ Study Materials
  • ➯ Softwares
  • ➯ Aptitude & Reasoning
  • ➯ Placement Assitance


  • MyJava Training Institute ,
  • Plot No.243 , shop No 14 ,
  • Secnd Floor , Zone-II ,
  • M.P.Nagar , Bhopal,
  • Madhya Pradesh ( 462011 )
  • ☎  08871209400 , 7987028543
  • 🌐
FacebookGoogle +TwitterYouTube

MyJava - java Training Institute