Gaurav, This one is tricky. I think I am going to be doomed when I take the test. MyTag extends TagSupport but it does not override the doStartTag() method. The return value for the default implementation of TagSupport.doStartTag() is SKIP_BODY. Therefore, the body is skipped and the doAfterBody() method is never executed. After doStartTag() returns SKIP_BODY, the thread of execution proceeds directly to doEndTag(). The default implementation of TagSupport.doEndTag() returns EVAL_PAGE.
hi gaurav, i think option 1 is right because 1. if we dont override doStartTag() method, then its default return value is SKIP_BODY. 2. after this doAfterBody() method never executes (since return value for doStartTag() method is SKIP_BODY) and the control passes to doEndTag() method. 3. since we dont override doEndTag() method, its default return value is EVAL_PAGE. 4. so the code prints only Hello
Joined: Sep 03, 2003
Thanx a lot Ture & sudhakar. It clears my doubt.
P.S: Less than 24 hrs left for me to take the exam. Keeping finger's crossed.