• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between EVAL_BODY_INCLUDE and EVAL_BODY_BUFFERED

 
Hendy Setyo Mulyo
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

What is the difference between EVAL_BODY_INCLUDE and EVAL_BODY_BUFFERED?
From my opinion, EVAL_BODY_INCLUDE is for body-content=empty or tagdependent and EVAL_BODY_BUFFERED is for body-content=JSP. Am I correct?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With EVAL_BODY_INCLUDE, you have no chance to work with the body, as it is simply being written to the client.
With EVAL_BODY_BUFFERED, the body is stored in a buffer, which you can decide to output or not, and even change its content.
(imagine a "upper" tag which would change the body's content in uppercase)

Note that if you are using BodyTagSupport, the default return value for doStartTag is EVAL_BODY_BUFFERED.

Details from the spec:
If EVAL_BODY_INCLUDE is returned, and the custom action element is not empty, setBodyContent() is not invoked, doInitBody() is not invoked, the body is evaluated and �passed through� to the current out, doAfterBody() is invoked and then, after zero or more iterations, doEndTag() is invoked. If the custom action element is empty, only doStart() and doEndTag() are invoked.

If EVAL_BODY_BUFFERED is returned, and the custom action element is not empty, setBodyContent() is invoked, doInitBody() is invoked, the body is evaluated, doAfterBody() is invoked, and then, after zero or more iterations, doEndTag() is invoked. If the custom action element is empty, only doStart() and doEndTag() are invoked.
 
Hendy Setyo Mulyo
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation, Satou.
I understand now
 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am need of differences between EVAL_BODY_INCLUDE AND EVAL_BODY_BUFFERED. While exploring java ranch i found this thread. After reading this thread i got a doubt...

If EVAL_BODY_INCLUDE is returned, and the custom action element is not empty


What is custom action element?


Thanks & Regards,
Vipul Kumar.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2345
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vipul Bondugula,

What is custom action element?

What they mean here is that the custom tag (= custom action element) has a body, so like:


Regards,
Frits
 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What they mean here is that the custom tag (= custom action element) has a body


Thank you Frits...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic