Writing Directive Element in XML Format

This section describes the syntax of writing Directive Elements in XML format for a JSP document. There are 3 types of Directive Elements: page, include and taglib.

Writing Directive Elements in XML format for a JSP Document is really easy. See syntax below:

<jsp:directive.directive_name attribute=value .../>

JSP 2.1 support 3 directive elements: page, taglib and include.

The most commonly used directive is probably the "page" directive, which specifies page level properties for the JSP container. Here is some examples:

<jsp:directive.page session="true"/>
<jsp:directive.page import="java.util.*"/>
<jsp:directive.page import="java.net.*" session="false"/>
<jsp:directive.page contentType="text/html"/>
<jsp:directive.page trimDirectiveWhitespaces="true"/>

Note that:

Another commonly used directive is the "include" directive, which tells the JSP server to include the specified JSP page into the current JSP page before converted to a Servlet class: Examples are:

<jsp:directive.include file="header.jsp"/>
<jsp:directive.include file="footer.jsp"/>

More details for "taglib" directive elements are provided later in the book.

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

 Tomcat 7 Installation on Windows Systems

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

Syntax of JSP Pages and JSP Documents

 Syntactic Elements of a JSP Page

 JSP Document - JSP Page in XML Format

 Writing Scriptlet Element in XML Format

Writing Directive Element in XML Format

 Writing Action Element in XML Format

 "include" Directive and Action Elements

 Execution Result of CurrentTime.jspx

 JSP Application Session

 Managing Cookies in JSP Pages

 JavaBean Objects and "useBean" Action Elements

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Outdated Tutorials


 PDF Printing Version