tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Passani <>
Subject Re: TagSupport vs BodyTagSupport
Date Sat, 23 Jul 2005 18:28:14 GMT

ooops, I felt this was a general taglib question, more than a Struts 
question. It only takes struts as an example,
but the question is "is there a reason why it makes sense to always 
subclass BodyTagSupport in a tag-library?"


Martin Cooper wrote:

>Once again, please ask questions about Struts on the Struts mailing
>lists, rather than here.
>Martin Cooper
>On 7/23/05, Luca Passani <> wrote:
>>Hello, I would love to hear about some taglib theory here.
>>My understanding is that, when creating a new tag, I can inherit from
>>either TagSupport or BodyTagSupport
>>depending on whether I need to manipulate  the tag content or not.
>>For this reason, most of my tags (WALL library) inherit from TagSupport
>>with the exception of one (which inherits from BodyTag).
>>Looking at the code for the Struts html tag-lib, I see that most tag
>>inherit from BaseHandlerTag (which looks
>>totally reasonable to me), which, in turn, inherits from BodyTagSupport,
>>even for tags that have no particular reason to do so,.
>>in fact, in moost cases, doAfterBody() ends up doing domething as simple as,
>> if (bodyContent != null) {
>>            String value = bodyContent.getString().trim();
>>            if (value.length() > 0) {
>>                text = value;
>>            }
>>        }
>>i..e,  just comsmetic for the returned source markup.
>>My question is, in general, what is the rationale for inheriting from
>>BodyTagSupport everywhere?
>>what is the performance hit when inheriting from BodyTagSupport as
>>compared to TagSupport?
>>Thank you

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message