Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EVAL_BODY_BUFFERED

 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Classic tag extends BodyTagSupport
2) doStartTag returns EVAL_BODY_BUFFERED

a) Will the body be evaluated? -> I tested this and body was not evaluated.
b) Will doAftetBodyTag() be invoked?
And since the body is never evaluated then doAfterBody() will never be invoked correct?

Please answer both the quesitons.
 
tanveer chowdry
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is not complete. Are you invoking the Tag with Empty Body ?

If that is the case then if you return EVAL_BODY_BUFFERED, the methods setBodyContent() and doInitBody() will not be called when the tag invoking the handler is empty. i.e if the body is empty it will directly go to the doEndTag().

If the tag invoking the handler is not empty and you are returning EVAL_BODY_BUFFERED, then we can be sure that in the TLD we don't have So the doAftetBody() has to be called.

Correct me if im wrong !
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the tag is invoked with a body content and the TLD does not have empty for <body-content/> tag. Now what will happen?
a) Will the body be evaluated?
b) If its evaluated will the result be buffered in some writer object?
c) Will the result be shown in the browser?
d)Will doAfterBody() be invoked?
Please clarify.
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the question is from Whiz labs series.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a) Will the body be evaluated?
Yes it will be evaluated.

b) If its evaluated will the result be buffered in some writer object?
setBodyContent is called by the container, so the body can be retrieved using getBodyContent. A BodyContent instance is passed to setBodyContent. BodyContent is a Writer which contains the result of the evaluation.

c) Will the result be shown in the browser?
No, you have to output the body yourself.

d)Will doAfterBody() be invoked?
Yes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic