File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 3285
    
    7
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.
 
 
subject: A question from mock exam