• 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?
0
PrakashVarma
Asked:
PrakashVarma
  • 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
return EVAL_BODY_TAG;
}


check these links that may help you.

http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags6.html
http://java.boot.by/wcd-guide/ch10.html
http://www.examulator.com/moodle/mod/resource/view.php?id=470
0
 
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.

http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_20726707.html?sfQueryTermInfo=1+10+30+bodytagsupport+tagsupport
0
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