aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Can doAfterBody() return EVAL_BODY_BUFFERED ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Can doAfterBody() return EVAL_BODY_BUFFERED ?" Watch "Can doAfterBody() return EVAL_BODY_BUFFERED ?" New topic
Author

Can doAfterBody() return EVAL_BODY_BUFFERED ?

Carlo Smits
Greenhorn

Joined: Jul 09, 2001
Posts: 22
Can doAfterBody() return EVAL_BODY_BUFFERED ?
The API just speaks of doAfterBody() returning SKIP_BODY or EVAL_BODY_AGAIN.
And if so, what is the implication of the return value EVAL_BODY_BUFFERED? Is it the same as would be with EVAL_BODY_AGAIN?
Thanks,
Carlo
yi zhu
Ranch Hand

Joined: Sep 10, 2002
Posts: 41
EVAL_BODY_BUFFERED is not a legal return value for doAfterBody(). It can only be returned by doStartTag()!
k space
Ranch Hand

Joined: Jun 25, 2002
Posts: 104
EVAL_BODY_BUFFERED and EVAL_BODY_AGAIN have the same int value (same as the deprecated EVAL_BODY_TAG).
So doAfterBody() can return EVAL_BODY_BUFFERED instead of EVAL_BODY_AGAIN.
This should work, but it is a bit confused. Also, EVAL_BODY_BUFFERED only exists in BodyTag. If your class does not implement BodyTag, you cannot use it.
[ December 30, 2002: Message edited by: ks wong ]

SCEA | SCBCD | SCWCD | SCJP - The kSpace
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Yes doAfterBody can return EVAL_BODY_BUFFERED if the tag handler implements BodyTag.
yi zhu
Ranch Hand

Joined: Sep 10, 2002
Posts: 41
The fact that EVAL_BODY_BUFFERED has the same value as EVAL_BODY_AGAIN is irrelevant here. This is an implementation issue. If you check the api doc, you will find the following about EVAL_BODY_BUFFERED:
Request the creation of new buffer, a BodyContent on which to evaluate the body of this tag. Returned from doStartTag when it implements BodyTag.
k space
Ranch Hand

Joined: Jun 25, 2002
Posts: 104
Originally posted by yi zhu:
Request the creation of new buffer, a BodyContent on which to evaluate the body of this tag. Returned from doStartTag when it implements BodyTag.

It means only if returned from doStartTag function.
If you check carefully the api (below) again, you will find that doAfterBody (same as doStartTag and other tag methods) is returning an int.
public int doAfterBody() throws JspException
That means, 1, 2, 3, EVAL_BODY_AGAIN, and EVAL_BODY_BUFFERED are all legal values. If both EVAL_BODY_AGAIN and EVAL_BODY_BUFFERED have the same int value (2), then returning either means the same.
[ December 31, 2002: Message edited by: ks wong ]
yi zhu
Ranch Hand

Joined: Sep 10, 2002
Posts: 41
Well, as an int EVAL_BODY_BUFFERED can be certainly returned by doAfterBody(). But It's no longer EVAL_BODY_BUFFERED which is meaningful only when it is return by doStartTag().
Sudd Ghosh
Ranch Hand

Joined: Oct 23, 2002
Posts: 187
Thank you all for clearing this matter/OR mess. I was almost going to post a question on this.


SCJP 1.4, SCWCD, SCBCD 1.3
Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
if EVAL_BODY_BUFFERED and EVAL_BODY_AGAIN is having same int value, Can doStartTag Method return EVAL_BODY_AGAIN when the TagHandler is implementing BodyTag?
boyet silverio
Ranch Hand

Joined: Aug 28, 2002
Posts: 173
after the good comments, these issues could be made also more clearer if some throwaway code is made to see whether these could work or not work. Cheers.
yi zhu
Ranch Hand

Joined: Sep 10, 2002
Posts: 41
It's not about whether the code will run or not.(The answer is yes)
The point here is that EVAL_BODY_BUFFERED has nothing to do with EVAL_BODY_AGAIN despite the fact that they have the same value.
By definition, EVAL_BODY_BUFFERED is returned by doStartTag and EVAL_BODY_AGAIN is returned by doAfterBody. That's why EVAL_BODY_TAG is deprecated!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can doAfterBody() return EVAL_BODY_BUFFERED ?