The J2EETM Tutorial
Home
TOC
PREV TOC NEXT Search
Feedback

Custom Tags in JSPTM Pages

by Stephanie Bodoff

The standard JSP tags for invoking operations on JavaBeansTM components and performing request dispatching simplify JSP page development and maintenance. In addition, JSP technology 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, form processing, accessing databases and other enterprise services such as email and directories, and 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 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 pointers to some freely-available libraries see http://java.sun.com/products/jsp/taglibraries.html.

What is a Custom Tag?
The Example Tags
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
PREV TOC NEXT Search
Feedback