• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Return values of classic tag

 
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic