Web tier: servlets, JSP, Web frameworks: TagSupport Vs BodyTagSupport ....usage.

  1. TagSupport Vs BodyTagSupport ....usage. (1 messages)

    WHAT IS THE DIFFERENCES BETWEEN TagSupport and BodyTagSupport. and when to use eath of them give alll possible differences
  2. A BodyTag can manipulate its body, using its BodyContent object, while a normal Tag cannot. BodyTags are useful when you want to use or transform the contents of the tag.

    For example, suppose you want to have a <cust:param> tag that sets parameter values using the tag body:

    <cus:param name="[param-name]">[param-value]</cust:param>

    This would have to be implemented as a BodyTag, which could get the tag contents (and the parameter value) as follows:

    public int doAfterBody() {
        String paramValue = bodyContent.getString();
        // More logic ...