This functionality is supported through the 
findAncestorWithClass(Tag, Class) 
static method of the Tag class which uses a reference to parent tag kept by each Tag instance, 
which effectively provides a run time execution stack.
Frequently there are constraints on how actions are to be used and when these constraints are 
not kept an error should be reported to the user.  There are several mechanisms in the JSP 1.1 
specification to describe syntactic and semantic constraints among actions; future 
specifications may add additional mechanisms.
Syntactic Information on the TLD
The Tag Library Descriptor contains some basic syntactic information.  In particular, the 
attributes are described including their name, whether they are optional or mandatory, and 
whether they accept request time expressions.  Additionally the 
 attribute can 
be used to indicate that an action must be empty.
All constraints described in the TLD must be enforced.  A tag library author can assume that 
the tag handler instance corresponds to an action that satisfies all constraints indicated in the 
Syntactic Information in a TagExtraInfo Class
Additional translation time validation can be done using the 
 method in the 
 class. The 
 method is invoked at translation time and is passed a 
 instance as its argument.
Raising an Error at Action Time
In some cases, additional request time validation will be done dynamically within the 
methods in the tag handler. If an error is discovered, an instance of 
 can be 
thrown. If uncaught, this object will invoke the errorpage mechanism of the JSP 
Chapter 5
Tag Extensions

JSP Web Hosting JavaServer Pages Specifications JSP Hosting Business web hosting division of Vision Web Hosting Inc. All rights reserved.