O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required