• Post Reply Bookmark Topic Watch Topic
  • New Topic

Return values of classic tag

 
Harshana Dias
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

In HFSJ page 595 Q10 says,

doAfterBody() is only called when doStartTag() returns EVAL_BODY_INCLUDE

But even doStartTag() return SKIP_BODY isnt doAfterBody() evaluate?

Secondly in Q9,

Given the following tag <mytags:mytag>BodyContent</mytags:mytag>

It says we have to put EVAL_BODY_INCLUDE in doStart() for out put "BodyContent". But what if we put EVAL_BODY_BUFFERED. It says "it directs the body of the tag to a buffer which this tag does not process" I cant understand the above statement. i mean purpose having BodyTagSupport class is for access the body contents know?

Some one please explain.

Thank You.
 
Mateus Lucio
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harshana, here my understanding:

When you return SKIP_BODY you're saying that the tag doesn't have a body, so there's no point in running doAfterBody() method, when you return EVAL_BODY_INCLUDE you are saying to your tag process the body (and implicity saying that you tag has a body, it may be empty but it's still a body) so it makes sense to call doAfterBody() method.

About the statement
"it directs the body of the tag to a buffer which this tag does not process" I believe the book means the example tag doesn't process the body you could write one that does.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!