Simple Actions with non empty Bodies
If a tag library descriptor maps an action with a non empty body to a tag handler that 
implements the 
Tag
 interface, the tag handler cannot 
manipulate
 this body because there is 
no mechanism for the tag handler to access that body.  To make the situation more explicit, 
the return value of 
doStartTag
 is either SKIP_BODY, EVAL_BODY_INCLUDE or 
EVAL_BODY_TAG.  The meanings are as follows:
SKIP_BODY means do not process the body of the action (if it exists).
EVAL_BODY_INCLUDE means process the body of the action but do not create a new 
BodyContent (see below) nor change the value of the out implicit object.
EVAL_BODY_TAG means create a new 
BodyContent
, change the value of the out 
implicit object and process the body of the action.
A typical use for EVAL_BODY_INCLUDE could be a conditional inclusion action tag.  
Since the body is to be passed through directly,  there is no need for the tag handler to 
manipulate it, and thus the tag handler needs not implement 
BodyTag
.
To help in catching errors, EVAL_BODY_INCLUDE is not valid in a tag handler that 
implements 
BodyTag
, while EVAL_BODY_TAG is not valid in a tag handler that 
implements 
Tag
 but does not implement BodyTag.
5.4.3
The TagSupport Base Class
The 
TagSupport
 class is a utility class intended to be used as the base class for new tag 
handlers.  The TagSupport class implements the 
Tag
 interface and adds additional 
convenience methods including getter methods for the properties in 
Tag
.  
TagSupport
 has 
one static method that is included to facilitate coordination among cooperating tags.
Tag findAncestorWithClass(Tag,
class)
Find the instance of a given class type that is closest to a given  instance. This 
method uses the 
getParent
 method from the 
Tag
 interface.
The return value of the 
doStartTag()
 method is 
SKIP_BODY
.  The return value of the 
doEndTag(
) method is 
EVAL_PAGE
.
5.4.4
Body Protocol: BodyTag Interface
The 
BodyTag
 interface extends 
Tag
 with methods to manipulate the body of an action. 
These methods act on the 
bodyContent
 property of a 
BodyTag
 instance.
103
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.