• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

QUESTION ID: 1078868194546 - JWebPlus

 
Leandro Sales
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following JSP document

1.<jsp:root xmlns:"http://java.sun.com/JSP/page" version="2.0">
2. <jsp irective.page contentType="text/html" />
3. <h1>Hello</h1>
4. <jsp:scriptlet>
5. for(int i=0; i<5; i++)
6. {
7. out.println("World");
8. }
9. </jsp:scriptlet>
10. <jsp:text>!!!</jsp:text>
11.</jsp:root>
Which of the following statements are correct?




Select 1 correct option.
a This will generate output without any errors.


b Line 3 must be enclosed in <jsp:text> and </jsp:text>.


c Although line 3 is valid but "Hello" will not be displayed as HEADER1 format in the browser.


d Line 5 is invalid.
It should be written as:
for(int i=0; i&lt;5; i++)

e Line 10 is invalid.

The answer is letter D... ok... But line 3 is incorrect too, isn't it?

if letter B was:
Line 3 must be enclosed in <jsp:text><![CDATA[ and ]]></jsp:text>.

It will be correct too???
 
marco borsato
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 3 looks like a well formed XML fragment. It is not validated by DTD or schema but apparently that is not necessary.
 
marco borsato
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something else i noticed there is no prefix in the jsp:root tag. It should be xmlns:jsp. This means that all usage of jsp: in this file is invalid!!!
 
Leandro Sales
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Marco...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic