• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

QUESTION ID: 1078868194546 - JWebPlus

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx Marco...
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic