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

HFSJ Mock exam question 8

 
Anant Rao
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 <!--X-->
2 <%=A.b()%>
3 <!--<%=A.b()%>-->
4 <%--y--%>
Assue that call to A.b() is valid and returns the text test. Ignoring whitespace in the generated response. which represents the Html this JSP wourld produce

a. <!--X-->test<!--<%A.b()%>-->
b. <!--X-->test<!--test-->
remaining are out of scope.

I thought answere is 'a' becasue anything in HTML comments should be displayed as it is even though <%=A.b()%> is compiled ...but book says bis correct.

can anybody please clarify.

Thanks
Infyniti.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by infyniti molugu:
1 <!--X-->
2 <%=A.b()%>
3 <!--<%=A.b()%>-->
4 <%--y--%>
Assue that call to A.b() is valid and returns the text test. Ignoring whitespace in the generated response. which represents the Html this JSP wourld produce

a. <!--X-->test<!--<%A.b()%>-->
b. <!--X-->test<!--test-->
remaining are out of scope.

I thought answere is 'a' becasue anything in HTML comments should be displayed as it is even though <%=A.b()%> is compiled ...but book says bis correct.

can anybody please clarify.

Thanks
Infyniti.


The JSP expression in the HTML comments are evaluated and the result is placed in the output. It is like any tamplete text for the container. The browser at the client side recognize that these are the HTML comments. The Container does not evaluate the codes in the JSP Comment.

Hope this help.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic