Name

Tag Interface

Interface name:

javax.servlet.jsp.tagext.Tag

Extends:

None

Implemented by:

Custom action tag handler classes and javax.servlet.jsp.tagext.TagSupport

Description

The Tag interface should be implemented by tag handler classes that do not need access to the body contents of the corresponding custom action element and do not need to iterate over the body of a custom action element.

Methods

public int doEndTag() throws JspException

Performs actions when the end tag is encountered. If this method returns SKIP_PAGE, execution of the rest of the page is aborted and the _jspService() method of JSP page implementation class returns. If EVAL_PAGE is returned, the code following the custom action in the _jspService() method is executed.

public int doStartTag() throws JspException

Performs actions when the start tag is encountered. This method is called by the web container after all property setter methods have been called. The return value controls how the action’s body, if any, is handled. If it returns EVAL_BODY_INCLUDE, the web container evaluates the body and processes possible JSP elements. The result of the evaluation is added to the response. If SKIP_BODY is returned, the body is ignored.

A tag handler class that implements the BodyTag interface (extending the Tag interface) can return EVAL_BODY_TAG instead of EVAL_BODY_INCLUDE. The web container then creates a BodyContent instance and makes it available to the tag handler for special processing.

public Tag getParent() ...

Get JavaServer Pages Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.