• 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

Custom Tag Qn

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found this qn in one of the mocks, Ans to this qn is E,
Can some body explain how its E, as i was thinking C will be more appropriate.

In which of the following cases will the method doAfterBody() of a tag handler be invoked?
Select 1 correct option.
a This method will always be called when the body of the tag is not empty.
b This method will be called only when the body of the tag IS empty.
c This method will be called only when doStartTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.
d This method will be called only when doEndTag() returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED.
e This method will be called if doAfterBody() returns IterationTag.EVAL_BODY_AGAIN.
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Option C says that doAfterBody is only called when doStartTag() returns EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED, but there are other possibilities (like the one described in option E). => C is not correct

If doAfterBody returns EVAL_BODY_AGAIN, then doAfterBody is called once again => E is correct
[ May 22, 2006: Message edited by: Rodrigo Alvarez ]
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Analyzing the given options

a.) Wrong, as the doStartTag() will have to return EVAL_BODY_INCLUDE even though the body of the Tag is not empty by default doStartTag() retuns SKIP_BODY.

b.) Wrong, the method will never be invoked if the body is empty.


c.) doStartTag() returns BodyTag.EVAL_BODY_BUFFERED the doAfterBody() is not invoked !!!, the content of the body is buffered.

d.) Wrong. doAfterBody() if invoked is executed after doStartTag() and before doEndTag().

e.)TRUE. the doAfterBody is re executed if doAfterBody() returns EVAL_BODY_AGAIN.


From the above choices E is the most appropriate answer to me.


Hope that helps
Reshma
 
I'm so happy! And I wish to make this tiny ad happy too:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic