j2ee: Creating Tags [8/27] ![]() ![]() ![]() |
A custom tag consists of a tag handler and a tag library descriptor
Types:
Tag, BodyTag
or IterationTag
interfaces.
SimpleTag
or
tag extensions created using only JSP syntax
instead of Java
To use the tag:
A custom tag must implement the javax.servlet.jsp.tagext.Tag
or javax.servlet.jsp.tagext.SimpleTag
interface (which now extends javax.servlet.jsp.tagext.JspTag
for organizational purposes
This is usually done by extending a base utility class
javax.servlet.jsp.tagext.SimpleTag implements JspTag
javax.servlet.jsp.tagext.TagSupport implements IterationTag, Tag
javax.servlet.jsp.tagext.BodyTagSupport implements BodyTag, IterationTag, Tag
IterationTag extends Tag
BodyTag extends IterationTag
The Tag
interface supplies doStartTag()
and doEndTag()
BodyTag
supplies doInitBody(), setBodyContent()
IterationTag
supplies doAfterBody()
TryCatchFinally
supplies doCatch(), doFinally()
and helps tags manage resources better