File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes doAfterBody() question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "doAfterBody() question" Watch "doAfterBody() question" New topic
Author

doAfterBody() question

Terrence White
Ranch Hand

Joined: Jun 26, 2002
Posts: 39
On page 323 (Table 16.8, chaper 16) of the SCWCD Exam Study Kit, the author states that the EVAL_BODY_BUFFERED constant can be returned by doStartTag() and doAfterBody(), for tags that implement the BodyTag interface.
Is that really true?
I cannot find proof of this in the Servlet API nor the servlet spec.
From reading these, I am led to belive that only IterationTag.EVAL_BODY_AGAIN or Tag.SKIP_BODY can be returned by doAfterBody(), even when the tag implements the BodyTag interface. Am I correct?

I am studying for the 1.3 test, not the 1.4 beta, so I am only looking at version 1.2 of the JSP spec.
Edwin Keeton
Ranch Hand

Joined: Jul 10, 2002
Posts: 214

From the documentation for:
javax.servlet.jsp.tagext
Interface BodyTag
A tag handler that implements BodyTag is treated as one that implements IterationTag, except that the doStartTag method can return SKIP_BODY, EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED.


SCJP, SCWCD
Edwin Keeton
Ranch Hand

Joined: Jul 10, 2002
Posts: 214

Sorry, I missed the second part of the question.
doAfterBody() is of course defined in the IterationTag interface and can return Tag.SKIP_BODY or IterationTag.EVAL_BODY_AGAIN.
BodyTag interface extends IterationTag and inherits the doAfterBody() method. The reason a tag implementing BodyTag can return BodyTag.EVAL_BODY_BUFFERED from doAfterBody() is that BodyTag.EVAL_BODY_BUFFERED is defined to have the same value (i.e., 2) as IteraionTag.EVAL_BODY_AGAIN. So in the context of BodyTag.doAfterBody() they mean the same thing.
The explanation is kind of messy, but the book is correct.
Terrence White
Ranch Hand

Joined: Jun 26, 2002
Posts: 39
Thanks for clearing that up for me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doAfterBody() question
 
Similar Threads
subclass of BodyTagSupport - Incompatible argument in doStartTag()
Question Bank ID: 44
q on SKIP_PAGE constant
Taglib - doAfterBody without doInitBody - DUH!!!
Return value of doAfterBody