javax.servlet.jsp.tagext
Interface Tag

All Known Subinterfaces:
BodyTag, IterationTag
All Known Implementing Classes:
TagSupport

public interface Tag

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

public static final int SKIP_BODY

EVAL_BODY_INCLUDE

public static final int EVAL_BODY_INCLUDE

SKIP_PAGE

public static final int SKIP_PAGE

EVAL_PAGE

public static final int EVAL_PAGE
Method Detail

setPageContext

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

setParent

public void setParent(Tag t)
Sets the containing tag.

getParent

public Tag getParent()
Returns the containing tag.

doStartTag

public int doStartTag()
               throws JspException
Callback to handle the start of a tag.
Returns:
SKIP_BODY to ignore the body and EVAL_BODY_INCLUDE to evaluate the body.

doEndTag

public 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.

release

public 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.