• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock exam at www.podar.net

 
Tong Chen
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ page language="java" %>
The Following are the contents of test.jsp
1 <html>
2 <head><title>A Comment Test</title></head>
3 <body>
4 <h2>A Test of Comments</h2>
5 <!-- This is Html Hidden Comment -->
6 <%-- This is JSP Hidden Comment --%>
7 </body>
8 </html>
On executing test.jsp guess the correct output
a) Line 5 is inserted in response but Line 6 is not inserted in response
b) Line 5 and Line 6 are inserted in response
c) Both Line 5 and Line 6 are not inserted in response
d) Line 5 is not inserted in response but Line 5 is inserted in response
---------------------
The anwser it gave me is a).
But I think it is c) and I grabbed the above code and tested it. neither line 5 nor line 6 was displayed.

Any comment? Thanks,
On executing test.jsp guess the correct output
 
adous
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The reason is
<%-- is a comment of Jsp --%> compiler ignores these statments, so line 5 is not inserted in response.
<!-- is a comment of HTML --> compiler will insert statement as out.println("<!-- ... -->") into response.
Regards
adous
 
seenu maj
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where in podar.net is the exam?
 
Chintan Rajyaguru
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me add this to what adous_sg (name not according to the naming policy) said,
<!-- date is <%=new java.util.Date()%> -->
If you have the above line in your jsp, you will not see any out put on your browser because it is an HTML comment. However, your Servlet engine will process this (because IT IS INCLUDED in the response) and produce date and put the date in HTML comment. So if you see VIEW SOURCE, you should see
<!-- date is Sunday (actual date).... -->
If you have <%-- something --%>, it is considered as JSP comment, servlet engine will not even process it and hence will not include in the response.
Conclusion: Answer is (a)
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seenu maj:
Where in podar.net is the exam?

Yes .. where is Mock on poddar.net.. even I register myself .. but there was some free mail service.. nothing abt mock ?
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it ..
its here http://www.podar.net/cgi-bin/scwcd/startexam.htm
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tong.
The answer maybe this:
If u rt click & view source the test.jsp then u;ll see the html comment but not the jsp comment.
Am i right or am i left?
Ved.
SCJP2.
 
Sumit Amar
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How many questions does it have?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic