Page Directive in JSP, Attributes of @ Page Directive in JSP, Use of Page Directive in JSP


Page Directive in JSP, Attributes of @ Page Directive in JSP, Use of Page Directive in JSP

Page Directive is used to specify the JSP page info to the Web Container like page language, page will participate in sessions or not, you can specify the API' list which are import to your JSP page, the Page directive can be placed anywhere into the JSP page but the best practice is to write it top of the page.

Syntax of Page Directive

<%@ page attribute="value"%>

List of Page Directive Attributes

language:- This attribute is used to specify the default language for the JSP page.
session:- The session attribute used to specify whether the page participate in session or not, the value for the session attribute can be true or false.
extends:- This attribute specify the super class used by the JSP page.
import:- This attribute specify the list of API's included into the JSP page.
isErrorPage:- This attribute specify the page is the error page URL or not by specify into the another JSP errorPage attribute.
errorPage:- This attribute used to specify the URL of the error handler page.
contentType:- This attribute is used to specify the content type of the particular JSP page.
isThreadSafe:- This attribute specify the threading model used by the JSP page. the default value for this attribute is true, if you set it false then the Container will serialize the multiple requests and the servlet uses the SingleThreadModel for it.
isELIgnored:- This attribute specify the Expression Language ignored by the JSP page or not. By default the Expression language is enabled by the JSP page. It means the value is false by default.
info:- This attribute is simply used to specify the information for the JSP page which is retrieved by the getServletInfo() method later.

Example of the Page Directive

<%page language="java" import="java.io.*" session="true" isErrorPage="false" info="This is the JSP Example" %>

thanks for visiting

{ 0 comments... read them below or add one }

Post a Comment