posted 21 years ago
This is a question from JWebPlus mock exam.
Which of the following is a correct statement about the life-cycle methods of a custom tag?
1. setBodyContent is always called on a tag handler that implements BodyTag
2. doAfterBody is always called on a tag that implements IterationTag.
3. doAfterBody will be called if the handler extends TagSupport
4. doAfterBody will be called if the handler extends IterationTagSupport
Corret answer given is 3. and explanation to the statement is ---
TagSupport implements IterationTag. Therefore, doAfterBody() will be called if the handler extends TagSupport.
However, it looks like the default return value for the doStartTag() in TagSupport is SKIP_BODY. If doStartTag() returns SKIP_BODY, will the body then not be evaluated and the next method called would be doEndTag()???
It doesn't seem like JUST because we extend TagSupport that doAfterBody() is guaranteed to be called.
Any Ideas ???