• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question in HFSJ mocks page 802

 
Sherif Shehab
Ranch Hand
Posts: 487
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question in HFSJ mocks page 802
Given thid jsp snippet :
<!-- X -->
<%= A.b() %>
<!-- <%= A.b() %> -->
<%-- Y--%>
Assume that call A.b()is valid and returns the text test ,Ignoring whitespace in the genreated response which represents the html this jsp would produce?

a- <!-- X --> test <!-- <%= A.b() %> -->
b- <!-- X --> test <!-- test -->
c- test
d- <!-- X --> test <!-- <%= A.b() %> --> <%-- Y--%>
e- test<%-- Y--%>
f- the genrated html will be blank

the answer is :B , but when i tried the result was c- test , this means that all the commented code will not appear !!

any clarification ?
 
naresh govindaswmay
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
when i tried this one i have got "Test" is the output.how come B will be the answer.

Thanks and regards
naresh govindaswamy
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Have you seen the source of html generated in browser. The HTML comments will not appear in browser screen.

Thanks
 
Sherif Shehab
Ranch Hand
Posts: 487
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya this what i'm saying that the commented code will not display , So i think the right answer is C rather B,


Any comments?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question is not about what is going to be displayed but
which represents the html this jsp would produce
. As Narendra said, check the Html source, not what is shown in your browser.
 
Sherif Shehab
Ranch Hand
Posts: 487
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry but i can't understand "check the Html source"
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, this is absolutely essential to learn as a web programmer.

Assuming you are using Internet Explorer, right click in an open area in the browser window and then select View Source. You could also go to the browser's upper menu and select View and then Source. It's very straightforward.

Doing this shows you the html in all its raw glory, which will include the comments that are not rendered into text for browser display.
 
Sherif Shehab
Ranch Hand
Posts: 487
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marc Peabody:
Well, this is absolutely essential to learn as a web programmer.

Assuming you are using Internet Explorer, right click in an open area in the browser window and then select View Source. You could also go to the browser's upper menu and select View and then Source. It's very straightforward.

Doing this shows you the html in all its raw glory, which will include the comments that are not rendered into text for browser display.


ya i know this , i made it & i found as they choose B, but how in the further questions i can know that he wants the HTML source or the output of the HTML ??
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These kinds of questions will always expect HTML source (unless stated otherwise). They want to make sure you understand the difference between HTML and JSP comments and that you understand which of the two are sent to the client.

This may seem trivial, but distinguishing between the two can be important. For instance, there may be times that you want to include comments that you absolutely do not want the end user to have the opportunity to discover.
 
Sherif Shehab
Ranch Hand
Posts: 487
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot for the clarification
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic