Chapter 7. JSP Directives

It is almost impossible to create a Web-based application using JSPs without the use of JSP directives. Yet, JSP directives do not generate code. They are not part of the logic within the JSP code. Rather, JSP directives provide directions and instructions to the container, telling it how to handle certain aspects of JSP processing.

JSP developers should have an intimate understanding of the following JSP directives and when they should be used:

  • The page directive

  • The taglib directive

  • The include directive

This chapter presents the most common usage of each of the directives, together with other frequently used variations. Important attributes associated with each directive are also discussed. In some cases, the discussion leads to some more obscure uses of the directives.

Other topics relating to the use of JSP directives are also explored. These topics include the following:

  • How a JSP is processed by the container

  • JSP container processing and interactions with JSP directives

  • How to use the XML representation of the directives

  • Different ways of including JSP fragments

By the end of this chapter, you will have a thorough understanding of each JSP directive. You will be able to determine the situations under which a directive should be used. You will also be familiar with possible attribute values and their effect on JSP processing. Most important, you will be able to use the JSP directives productively in your daily JSP development.

Directive Basics

JSP directives can ...

Get Beginning JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.