File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question 19 of HFSJ Final mocktest 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 "Question 19 of HFSJ Final mocktest" Watch "Question 19 of HFSJ Final mocktest" New topic

Question 19 of HFSJ Final mocktest

geeta vemula
Ranch Hand

Joined: Jul 18, 2008
Posts: 208
A Classic tag handler exists in legacy code. The author wrote a handler that evaluates its tag body a hundred times, to be used in testing other tags that produce random content.
What is incorrect about the code?
A. Tag handlers are not thread safe, so the iterationCount can become out of sync if multiple users are reaching the page at the same time.
B. The doAfterBody method is never being called because it is not part of the tag handler lifecycle. The developer should have extended the IterationTagSupport class to include this method in the lifecycle.
C. The doTag method should be doStartTag. As written, the default doStartTag of TagSupport is called which simply returns SKIP_BODY, causing doAfterBody to never be called.
D. When doAfterBody returns EVAL_BODY_AGAIN the doTag method is called again. The doTag method resets iterationCount to 0, resulting in an infinite loop and a java.lang.OutOfMemoryError is thrown.

Answer is C.

here we need to choose correct one or incorrect one??
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
There is something wrong with this question.

TagSupport does not have a 'doTag' method, only SimpleTagSupport has. There should be a doStartTag method involved.

JDBCSupport - An easy to use, light-weight JDBC framework -
I agree. Here's the link:
subject: Question 19 of HFSJ Final mocktest
It's not a secret anymore!