Processing Body Content with a Custom Tag

One of the most interesting features of the JSP tag extension mechanism is that the tags can access their own body content. That is, a tag can see the text contained between its begin and end tags and even modify that text.

Processing body text is a little more involved and requires a specialized tag interface. A basic tag implements an interface called Tag and usually inherits from the TagSupport class. A tag that processes its body text must implement the BodyTag interface and usually inherits from BodyTagSupport.

Because the BodyTag interface extends the Tag interface, it includes the doStartTag and doEndTag methods. A tag implementing the BodyTag interface can still return SKIP_BODY from the doStartTag ...

Get Special Edition Using Java™ 2 Enterprise Edition 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.