The directive tag provides additional information to the JSP Engine regarding the jsp page. JSP directives change the way JSP Engine processes the page. Directive tag allows the user to import packages, define error handling pages or session information of JSP page.
JSP defines three types of directive tag.
page directive : page directive sets page-level preferences for the JSP. Here is the syntax for the page directive:
<%@ page optional attribute ... %>
e.g. <%@page language="java" %>
the optional available for page directive are:include directive : include directive allows the developer to include other JSP or static page when JSP is translated into a servlet, while the action <jsp:include> includes the resources at request time.
<%@ include optional attribute ... %>
e.g.: <%@ include file="/header.jsp" %>
taglib directive : This directive allows the user to create their own custom tags.
<%@ taglib optional attribute ... %>
e.g.: <%@ taglib prefix="x" uri="foo" %>
To learn more about JSP directive click on the link:
Liked it! Share this Tutorial