Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Return values of classic tag

 
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.
 
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic