Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can doAfterBody() return EVAL_BODY_BUFFERED ?

 
Carlo Smits
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EVAL_BODY_BUFFERED is not a legal return value for doAfterBody(). It can only be returned by doStartTag()!
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes doAfterBody can return EVAL_BODY_BUFFERED if the tag handler implements BodyTag.
 
yi zhu
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for clearing this matter/OR mess. I was almost going to post a question on this.
 
Mathew Sam
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic