• JavaScript
  • jQuery
  • Core Java
  • Struts
  • Spring
  • Java IO
  • PHP
  • RubyonRails
  • SQL Tutorial

  • <

    JSP Page Directive Tutorial

    The Page directive provide attributes to the entire JSP page.It defines attributes, such as scripting language, error page.You can write directives anywhere in your JSP page.

    Jsp Page Directive Syntax

    <%@ page attribute="value" %>

    Jsp Page Directive Attributes List:

  • import attribute
  • language attribute
  • extends attribute
  • session attribute
  • isThreadSafe attribute
  • isErrorPage attribute
  • errorPage attribute
  • contentType attribute
  • autoFlush attribute
  • buffer attribute

  • Page Directive Import Attribute

    This attribute is used to import packages.You can import more than one package at the same place separated by commas.

    Import Attribute Example

    <%@page import="java.io.*%>
    <%@page import="java.io.*, java.lang.*"%>

    Page Directive Session Attribute

    Session attribute is used to handle HTTP sessions for JSP pages.

    Session Attribute Example

    <%@ page session="true"%>
    <%@ page session="false"%>

    Page Directive isErrorPage Attribute

    isErrorPage attribute is used to identify a page can be used an error page for another page.

    isErrorPage Attribute Example

    <%@ page isErrorPage="true"%>
    //can be true or false

    Page Directive errorPage Attribute

    errorPage attribute is used to identify the URL of a JSP page which has isErrorPage attrbute set to true.

    errorPage Attribute Example

    <%@ page errorPage="Exception.jsp"%>

    Page Directive contentType Attribute

    Used to set content type.

    contentType Attribute Example

    <%@ page contentType="text/html"%>

    Page Directive isThreadSafe Attribute

    If isThreadSafe set as true, it means that the JSP page supports multithreading.

    isThreadSafe Attribute Example

    <%@ page isThreadSafe="false"%>

    Page Directive buffer Attribute

    It is used to set the size of buffer.

    buffer Attribute Example

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

    Page Directive extends Attribute

    It is used to inherit class.

    extends Attribute Example

    <%@ page extends="packagename.SampleClass"%>

    Page Directive info Attribute

    Description of a jsp page.

    info Attribute Example

    <%@ page info="This code is given by Chaitanya Singh"%>

    h2>Page Directive language Attribute

    It describe what scripting language being used in the page.

    language Attribute Example

    <%@ page language="java"%>

    Page Directive autoFlush Attribute

    When buffer is full then it will flush by autoFlush.

    autoFlush Attribute Example

    <%@ page autoFlush="true"%>
    //it can be true or false.

    Page Directive isScriptingEnabled Attribute

    Its default value is true.

    isScriptingEnabled Attribute Example

    <%@ page isELIgnored="true"%>

    © copyright 2017-2021 Completedone pvt ltd.