====== JSP Directives ====== <%@ directive attribute="value" %> <%@ directive attr1="value" attr2="value" ... attrN="value" %> Directives are used to specify the structure of the resulting servlet. There are three directives: page, include, and taglib ===== The page Directive ===== There are 11 specifiable attributes for this directive: import, contentType, isThreadSafe, session, buffer, autoflush, extends, info, errorPage, and language Example <%@ page language="java" contentType="text/html" %> <%@ page contentType="application/vnd.ms-excel" %> <%@ page import="java.util.*" %> <%@ page import="java.util.*,java.io.*" %> Directives can be placed anywhere in the document, but are often placed at the very top. <%@ page language="java" contentType="text/html import="java.util.*" %> Hello World

Hello World

Today is: <%= new Date().toString() %>
===== The include Directive ===== Is used to include a file in the main document. There are two versions of this. The first one, shown below, includes the file at translation time. <%@ include file="relative URL of file" %> The second version, includes the file at request time. ===== The taglib directive ===== This is used to define custom markup tags. Refer to JSP documentation for details on this.