Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Documents - 11th hour confusion

 
Patrick Williams
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • 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 ]
 
Daniel Dalton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • 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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • 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
 
Ravi Appana
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic