• 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

JSP Documents - 11th hour confusion

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone, On page 597 of HFSJ, it states that "There is more you have to know if you write this by hand - the whole document, for example, must be enclosed in a <jsp:root> tag (which includes some other stuff), and the taglib directives go inside the <jsp:root> opening tag, rather than as a <jsp:directive>.

On pg 763 & 801, Q6 of the final mock exam, You are asked which choices about a JSP document are correct (and choose all that apply).

A: A JSP document must have a <jsp:root> as its top element.

B: The following would be valid as the first line of a JSP document: <jsp:root xmlns:uri="http://java.sun.com/JSP/Page" version="2.0">.

I wont list all of the choices in the spirit of "not giving the book away for free", but I am not sure why A or B are incorrect answers. can someone please explain? Thanks.

[ March 10, 2006: Message edited by: Patrick Williams ]

[ March 10, 2006: Message edited by: Patrick Williams ]
[ March 10, 2006: Message edited by: Patrick Williams ]
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at Sun's J2EE tutorial:

Creating a JSP Document

I'm definitely not claiming to be an expert, but if you look at their examples (especially the standard JSP converted to a JSP Document), it's clear that you are NOT required to have jsp:root as the top element.

Anyway - hope that gives you a start on it.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daniel is right. Page 597 is in error (you should submit it to the errata).

The mock exam is correct. For further confirmation, see this:
http://www.onjava.com/pub/a/onjava/2004/04/21/JSP2part3.html
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone explain why this option is wrong in the JSP Document:

B: The following would be valid as the first line of a JSP document: <jsp:root xmlns:uri="http://java.sun.com/JSP/Page" version="2.0">

The jsp prefix must always be bound to the JSP namespace: http://java.sun.com/JSP/Page

But, Is it an error to bound the JSP namespace "http://java.sun.com/JSP/Page" with a different prefix. Is the above option wrong, because of using the prefix "uri".
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic