This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes A question from mock exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "A question from mock exam" Watch "A question from mock exam" New topic
Author

A question from mock exam

seema khot
Greenhorn

Joined: Dec 26, 2002
Posts: 5
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 ???
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3255
    
    2
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?


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
seema khot
Greenhorn

Joined: Dec 26, 2002
Posts: 5
Thanks for your reply.
Here is the Question ID :1021097621653
Mike J. Beaty
Greenhorn

Joined: May 16, 2003
Posts: 9
Why is number 1 incorrect?
If you were to implement the BodyTag interface when would the servlet container not call this method?
Jian Su
Greenhorn

Joined: Dec 15, 2002
Posts: 5
When doStartTag() returns SKIP_BODY, it would not be called.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A question from mock exam
 
Similar Threads
doAfterBody()
custom tag lifecycle
Mock Exam Question.
question on custom tags
TagSupport -- IterationTag