Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question from Eduardo Cubian'sTest

 
Terrence White
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question from ]http://www.javaranch.com/carl/SCWCD.htm


Question 25)
Given the following tag handler defined with <bodycontent>JSP</bodycontent>
public class body extends TagSupport {
public int doStartTag() throws JspException{
return EVAL_BODY_INCLUDE;
}
public int doAfterBody() throws JspException {
try { pageContext.getOut().print("how are you?"); }catch(IOException e) {}
return SKIP_BODY;
}
}
what will be printed out by the following part of a jsp page?
<prefix:sufix>
<i>Hello</i>
</prefix:sufix>
1) The tag handler won't compile.
2) The jsp page will print Hello how are you?
3) The jsp page will print how are you? Hello
4) The jsp page will print Hello

The stated answer is:
4) The jsp page will print Hello
As far as I know you can't print from doAfterBdoy in a TagSupport handlers.


Is this correct?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic