• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

My understanding regarding custom tags

Hi Friends,
The doAfterBody method(in TagSupport class) is called after the body content is evaluated it means for the first time body content is evaluated by doStartTag method after that it is evaluated by doAfterBody method,right?and what is the difference between doAfterBody method in TagSupport class and BodyTagSupport class?
  • 3
1 Solution
chaitu chaituCommented:
The doAfterBody() method is invoked after the first evaluation of the body content (if it is not empty). By returning SKIP_BODY, the doAfterBody() method can tell the JSP container that the processing of the body content is finished:

public int doAfterBody() throws JspException {
// do something, or nothing
return SKIP_BODY;
}Sometimes the tag handler class must continually process the body content of a custom tag in a loop. You can tell the JSP container to repeatedly evaluate the body content and doAfterBody() invocation by returning EVAL_BODY_TAG from doAfterBody(). Note that because processing can change the body content or its context, each body content evaluation can have differing results.

public int doAfterBody() throws JspException {
//do something, or nothing

check these links that may help you.

chaitu chaituCommented:
BodyTagSupport allows manipulating the content of evaluating tag body. If you use TagSupport, evaluated body is placed to the page, and the user can do nothing with this. When using BodyTagSupport, the user can pick evaluated body from the buffer (BodyContent object) and transform it according his needs.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now