With BodyTag, you get two new methods

When you implement BodyTag (by extending BodyTagSupport), you get two more lifecycle methods—setBodyContent() and doInitBody(). You also get one new return value for doStartTag(), EVAL_BODY_BUFFERED. That means there are now three possible return values for doStartTag(), instead of the two you get when you extend TagSupport.

Lifecycle for a tag that implements BodyTag (directly or by extending BodyTagSupport)

image with no caption

Note

A change in the default return value for BodyTagSupport:

image with no caption

New return value, and it’s the default for BodyTagSupport. (Instead of SKIP_BODY, the default for TagSupport.)

Get Head First Servlets and JSP, 2nd 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.