Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock test question

 
Yogesh Hingmire
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>

The answer is 4) The jsp page will print Hello and reasn given is you cannot print inside a doAfterBody() is this true ?

Thanks,
Yogesh
 
rohini gundu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I have run that example and i got printed "How are you?" in the jsp.

Can you me the total question with the options so that we can check that.

i will print whatever we have written in the doAfterBody() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic