The J2EETM Tutorial
Home
TOC
Index
PREV TOP NEXT Search
Feedback

Custom Tags in JSP Pages

Stephanie Bodoff

The standard JSP tags for invoking operations on JavaBeans components and performing request dispatching simplify JSP page development and maintenance. JSP technology also provides a mechanism for encapsulating other types of dynamic functionality in custom tags, which are extensions to the JSP language. Custom tags are usually distributed in the form of a tag library, which defines a set of related custom tags and contains the objects that implement the tags.

Some examples of tasks that can be performed by custom tags include operations on implicit objects, processing forms, accessing databases and other enterprise services such as e-mail and directories, and performing flow control. JSP tag libraries are created by developers who are proficient at the Java programming language and expert in accessing data and other services, and are used by Web application designers who can focus on presentation issues rather than being concerned with how to access enterprise services. As well as encouraging division of labor between library developers and library users, custom tags increase productivity by encapsulating recurring tasks so that they can be reused across more than one application.

Tag libraries are receiving a great deal of attention in the JSP technology community. For more information about tag libraries and for pointers to some freely-available libraries see

http://java.sun.com/products/jsp/taglibraries.html
 

In This Chapter

What is a Custom Tag?
The Example JSP Pages
Using Tags
Declaring Tag Libraries
Types of Tags
Defining Tags
Tag Handlers
Tag Library Descriptors
Simple Tags
Tags with Attributes
Tags With Bodies
Tags That Define Scripting Variables
Cooperating Tags
Examples
An Iteration Tag
A Template Tag Library
How Is a Tag Handler Invoked?
Home
TOC
Index
PREV TOP NEXT Search
Feedback