javax.servlet.jsp.tagext
Interface Tag

All Superinterfaces:
JspTag
All Known Subinterfaces:
BodyTag, IterationTag, LoopTag
All Known Implementing Classes:
ActionListenerTag, AttributeTag, BodyTagSupport, BundleTag, BundleTag, CatchTag, ChooseTag, ConditionalTagSupport, CoreForEachTag, CoreForTokensTag, CoreImportTag, CoreOutTag, CoreParamTag, CoreParamTag, CoreRedirectTag, CoreSetTag, CoreSetTag, CoreUrlTag, CoreWhenTag, FmtParamTag, FmtParamTag, FmtParseDateTag, FmtParseNumberTag, FmtRequestEncodingTag, FmtSetTimeZoneTag, FmtTimeZoneTag, FmtTimeZoneTag, ForEachTag, FormatDateTag, FormatDateTag, FormatNumberTag, FormatNumberTag, ForTokensTag, I18NSupport, IfTag, IfTag, ImportTag, IntegerLoopSupportTag, IteratorLoopSupportTag, JspTagFileSupport, LoadBundleTag, LoopTagSupport, MessageTag, MessageTag, OtherwiseTag, OutTag, ParseDateTag, ParseNumberTag, PhaseListenerTag, RedirectTag, RemoveTag, RequestEncodingTag, SetBundleTag, SetBundleTag, SetLocaleTag, SetLocaleTag, SetPropertyActionListenerTag, SetTimeZoneTag, SqlDateParamTag, SqlDateParamTag, SqlParamTag, SqlParamTag, SqlQueryTag, SqlQueryTag, SqlSetDataSourceTag, SqlSetDataSourceTag, SqlTransactionTag, SqlTransactionTag, SqlUpdateTag, SqlUpdateTag, TagAdapter, TagSupport, UrlTag, ValueChangeListenerTag, WhenTag, XmlForEachTag, XmlIfTag, XmlOutTag, XmlOutTag, XmlParamTag, XmlParamTag, XmlParseTag, XmlParseTag, XmlSetTag, XmlTransformTag, XmlTransformTag, XmlWhenTag

public interface Tag
extends JspTag

Tags are Java classes implementing JSP Tag extensions. The class must have a null argument public constructor and implement the tag attribute as setXXX methods, following the Beans spec.


 MyTag tag = new MyTag();

 tag.setPageContext(page);
 tag.setParent(...);
 tag.setFoo(...);
 tag.setBar(...);
 if (tag.doStartTag() == EVAL_BODY_INCLUDE) {
   ...
 }
 if (tag.doEndTag() == SKIP_PAGE)
   return;
 ...
 tag.setParent(...);
 tag.setFoo(...);
 if (tag.doStartTag() == EVAL_BODY_INCLUDE) {
   ...
 }
 if (tag.doEndTag() == SKIP_PAGE)
   return;
 ...
 tag.release();
 


Field Summary
static int EVAL_BODY_INCLUDE
           
static int EVAL_PAGE
           
static int SKIP_BODY
           
static int SKIP_PAGE
           
 
Method Summary
 int doEndTag()
          Callback to handle the end of a tag.
 int doStartTag()
          Callback to handle the start of a tag.
 Tag getParent()
          Returns the containing tag.
 void release()
          Cleans up the tag at the end of the page.
 void setPageContext(PageContext page)
          Sets the page context of this page.
 void setParent(Tag t)
          Sets the containing tag.
 

Field Detail

SKIP_BODY

static final int SKIP_BODY
See Also:
Constant Field Values

EVAL_BODY_INCLUDE

static final int EVAL_BODY_INCLUDE
See Also:
Constant Field Values

SKIP_PAGE

static final int SKIP_PAGE
See Also:
Constant Field Values

EVAL_PAGE

static final int EVAL_PAGE
See Also:
Constant Field Values
Method Detail

setPageContext

void setPageContext(PageContext page)
Sets the page context of this page.


setParent

void setParent(Tag t)
Sets the containing tag.


getParent

Tag getParent()
Returns the containing tag.


doStartTag

int doStartTag()
               throws JspException
Callback to handle the start of a tag.

doStartTag can assume setPageContext, setParent, and all tag attribute properties have been called.

Returns:
SKIP_BODY to ignore the body and EVAL_BODY_INCLUDE to evaluate the body.
Throws:
JspException

doEndTag

int doEndTag()
             throws JspException
Callback to handle the end of a tag.

Returns:
SKIP_PAGE to skip the rest of the page and EVAL_PAGE to continue with the rest of the page.
Throws:
JspException

release

void release()
Cleans up the tag at the end of the page. The same tag instance might be reused for multiple tags in the page.