Difference between BodyTagSupport and TagSupport

If you need access to the actual body contents, so that you may use it in an expression or filter or even alter in some way, then you need to extend BodyTagSupport instead of TagSupport and you will have access to the BodyTag interface methods.

Extending BodyTagSupport gives you two more lifecycle methods from the BodyTag interface – setBodyContext() and doInitBody(). You can use these two do something with the actual contents of the body of the tag used to invoke the handler. You also get one new return value for the doStartTag() EVAL_BODY_BUFFERED

 

Leave a comment