From last post about tag in jsp. This post is about directive tag in more details. Directive tag can devide into three types e.g. page, include and taglib
page directive: page directive will provide the information about the page for jsp engine to compile that page.
Below are some importance attributes of page directive :
language tells the engine about language that the page is using.
usage: <%@ page language="java" %>
extends tell jsp engine that this page will extend from specify class.
usage: <%@ page extends="test.myclass" %>
import used to import any class to use in our jsp page. We can use comma(,) to import more than one packages.
usage: <%@ page import="java.sql.*,mypackage.myclass" %>
session="true|false", default is true so jsp pages are session enable.
usage: <%@ page session="true" %>
buffer, control buffer usage for that jsp page.
usage: <%@ page buffer="none" %>
autoFlush="true|false", if true will automatic clear when buffer is full.
usage: <%@ page autoFlush="true" %>
isThreadSafe="true|false", if true, jsp engine will create new thread for every concurrent request.
usage: <%@ page isThreadSafe="true" %>
errorPage tell the server that which page to go when got un-handled exceptions in the page.
usage: <%@ page errorPage="error.jsp" %>
more than one directives can be used by separate by space.
usage: <%@ page language="java" session="true" contentType="text/html;charset=ISO-8859-1" %>
include directive: include is used to include content in another file into the jsp page. You can use it for header or footer of the page.
usage: <%@ include file="/header.jsp" %>
taglib directive: next in jsp tag series
<%@ directive attribute="value" %>
page directive: page directive will provide the information about the page for jsp engine to compile that page.
Below are some importance attributes of page directive :
language tells the engine about language that the page is using.
usage: <%@ page language="java" %>
extends tell jsp engine that this page will extend from specify class.
usage: <%@ page extends="test.myclass" %>
import used to import any class to use in our jsp page. We can use comma(,) to import more than one packages.
usage: <%@ page import="java.sql.*,mypackage.myclass" %>
session="true|false", default is true so jsp pages are session enable.
usage: <%@ page session="true" %>
buffer, control buffer usage for that jsp page.
usage: <%@ page buffer="none" %>
autoFlush="true|false", if true will automatic clear when buffer is full.
usage: <%@ page autoFlush="true" %>
isThreadSafe="true|false", if true, jsp engine will create new thread for every concurrent request.
usage: <%@ page isThreadSafe="true" %>
errorPage tell the server that which page to go when got un-handled exceptions in the page.
usage: <%@ page errorPage="error.jsp" %>
more than one directives can be used by separate by space.
usage: <%@ page language="java" session="true" contentType="text/html;charset=ISO-8859-1" %>
include directive: include is used to include content in another file into the jsp page. You can use it for header or footer of the page.
<% include file="file to include" %>
usage: <%@ include file="/header.jsp" %>
taglib directive: next in jsp tag series
Comments