A Tab Library is described via a Tag Library Descriptor, an XML document that is described 
further below.
No custom directives can be described using the JSP 1.1 specification.
5.1.1
Goals
The tag extension mechanism described in this chapter addresses the following goals:
Portable   
An action described in a tag library must be usable in any JSP container.
Simple  
 Unsophisticated users must be able to understand and use this mechanism. We 
would like to make it very easy for vendors of functionality to expose it through actions.
Expressive  
 We want to enable a wide range of actions to be described in this mechanism, 
including:
Nested actions.
Scripting elements inside the body.
Creation, use and updating of scripting variables.
Usable from different scripting languages  
 Although the JSP specification currently only 
defines the semantics for scripting based on the Java programming language, we want to 
leave open other scripting languages.
Building upon existing concepts and machinery  
We do not want to reinvent machinery that 
exists elsewhere. Also, we want to avoid future conflicts whenever we can predict them. 
5.1.2
Overview
The basic mechanism for defining the semantics of an action is that of a 
tag handler
. A tag 
handler is a Java class that implements the 
Tag
 or 
BodyTag
 interfaces and that is the run 
time representation of a custom action.
The JSP page implementation class instantiates (or reuses) a tag handler object for each 
action in the JSP page.  This handler object is a Java object that implements the 
javax.servlet.jsp.tagext.Tag
 interface.  The handler object is responsible for the 
interaction between the JSP page and additional server side objects.
There are two main interfaces: 
Tag
 and 
BodyTag
.
Tag
 defines the basic methods that are needed in all tag handlers.  These methods include 
setter methods to initialize a tag handler with context data and with the attribute values of 
the corresponding action, and the two methods: 
doStartTag()
and 
doEndTag()
.
BodyTag
 provides two additional methods for when the tag handler wants to manipulate 
its body. The two new methods are 
doInitBody()
 and 
doAfterBody()
.
87
JavaServer Pages 1.1 Specification  
November 30, 1999




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.