Page Directives

The JSP page directive directs the JSP engine to specify the page setting during the Servlet translation time. It has many attributes. Some attributes have their default values.Page directive sets page properties used during translation.
  • JSP Page can have any number of directives
  • Import directive can only occur once
  • Embedded in <%@ and %> delimiters
Different directives are
  • Language: (Default Java) Defines server side scripting language (e.g. java)
  • Extends: Declares the class which the servlet compiled from JSP needs to extend
  • Import: Declares the packages and classes that need to be imported for using in the java code (comma separated list)
  • Session: (Default true) Boolean which says if the session implicit variable is allowed or not
  • Buffer: defines buffer size of the jsp in kilobytes (if set to none no buffering is done)
  • autoFlush:When true the buffer is flushed when max buffer size is reached (if set to false an exception is thrown when buffer exceeds the limit)
  • isThreadSafe: (default true) If false the compiled servlet implements SingleThreadModel interface
  • Info: String returned by the getServletInfo() of the compiled servlet
  • errorPage: Defines the relative URI of web resource to which the response should be forwarded in case of an exception
  • contentType: (Default text/html) Defines MIME type for the output response
  • isErrorPage: True for JSP pages that are defined as error pages
  • pageEncoding: Defines the character encoding for the jsp page

page language=“java”
import=“java.util.*, javax.sql.RowSet”