Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question from the mock test

 
trupti nigam
Ranch Hand
Posts: 627
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the question from Eduardo Cobian's mock test.
Given the following tag handler defined with <bodycontent>JSP</bodycontent>
public class body extends BodyTagSupport {
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 correct answer given is 4.
But tried the above example on Tomcat4..but I am getting the error as below:

javax.servlet.ServletException: Since tag handler class myServlets.tags.body does not implement BodyTag, it can't return BodyTag.EVAL_BODY_TAG
can any one explain me the correct answer and why I am getting this error..
Thanks in advance..
Trupti
 
trupti nigam
Ranch Hand
Posts: 627
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any answers ..to my question..
Thanks,
Trupti
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic