Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CustomTag - EVAL_BODY_BUFFERED

 
Karthik Rajendiran
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,
I have one doubt in custom tag. When the Custom Tag Handler class extends BodyTagSupport, we have EVAL_BODY_BUFFERED return value in doStartTag()

Question 1.
a. I have non-empty DD like TLD

b. I am invoking the tag with non-empty body.
<myT:CustomT> Hi i am karthik </myT:CustomT> FROM A JSP
CODE FOR THE JSP below



c. The Handler class



I dont get my TEXT INBETWEEN BODY DISPLAYED.
but when i use EVAL_BODY_INCLUDE i get it displayed.

can anyone help me whts thappening over the code.
PLEASE
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik,
Good that you tried this. When you return EVAL_BODY_INCLUDE, the body gets evaluated and sent to the response. When you return EVAL_BODY_BUFFERED, the body goes to a BodyContent Writer object. So, unless you override the setBodyContent(BodyContent) method and use the methods of BodyContent (which is actually a Writer) to manipulate the body (if you want) and explicitly write it to the output, the body will not get written to the output.It'll just stay with the Writer. Here you have not done anything with that Writer. That's why nothing happens.

hth..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic