wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes mock exam at www.podar.net Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "mock exam at www.podar.net" Watch "mock exam at www.podar.net" New topic
Author

mock exam at www.podar.net

Tong Chen
Ranch Hand

Joined: Apr 26, 2002
Posts: 1011
<%@ 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


Tong Chen (Seattle USA)<br />SCJP,SCWCD,SCDJWS,IBM XML,MCP.NET,MCAD.NET,MCSD.NET
adous
Greenhorn

Joined: May 02, 2002
Posts: 3
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


Regards<br />Adous<br />Sun Certified Programmer for Java 2 platform<br />Sun Certified Web Component Developer for J2EE
seenu maj
Greenhorn

Joined: Mar 12, 2002
Posts: 9
Where in podar.net is the exam?


what a wonderful world!
Chintan Rajyaguru
Ranch Hand

Joined: Aug 19, 2001
Posts: 341
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)


ChintanRajyaguru.com
SOADevelopment.com - Coming soon!
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
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 ?


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
got it ..
its here http://www.podar.net/cgi-bin/scwcd/startexam.htm
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
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

Joined: Jun 08, 2002
Posts: 180
How many questions does it have?


SCJP, SCWCD, OCA, OCP-DBA 9i, <a href="http://brainbench.com/transcript.jsp?pid=2232802" target="_blank" rel="nofollow">BCIP</a>, MCP, MCAD, MCSD.NET, MCDBA, MCTS (SQL 05), MCITP (DBD, DBA)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mock exam at www.podar.net
 
Similar Threads
could servlet include the jsp,html files???
Problem in request forwarding
How to escape % in JSP
question about directive
mock example doubt