• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

A question from mock exam

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a question from JWebPlus mock exam.
Which of the following is a correct statement about the life-cycle methods of a custom tag?
1. setBodyContent is always called on a tag handler that implements BodyTag
2. doAfterBody is always called on a tag that implements IterationTag.
3. doAfterBody will be called if the handler extends TagSupport
4. doAfterBody will be called if the handler extends IterationTagSupport
Corret answer given is 3. and explanation to the statement is ---
TagSupport implements IterationTag. Therefore, doAfterBody() will be called if the handler extends TagSupport.
However, it looks like the default return value for the doStartTag() in TagSupport is SKIP_BODY. If doStartTag() returns SKIP_BODY, will the body then not be evaluated and the next method called would be doEndTag()???
It doesn't seem like JUST because we extend TagSupport that doAfterBody() is guaranteed to be called.
Any Ideas ???
 
Enthuware Software Support
Posts: 4907
60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right. It should say something like, "doAfterBody may be called if the handler extends TagSupport"
Can you please mention the question id so that I can make a correction?
 
seema khot
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
Here is the Question ID :1021097621653
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is number 1 incorrect?
If you were to implement the BodyTag interface when would the servlet container not call this method?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When doStartTag() returns SKIP_BODY, it would not be called.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic