Steve Bang wrote:
>
> Based on Josh's comment, I thought a bit more about this issue, and looked
> at the finalized JSP 1.2 specification.  Although Sun still has one example,
> which uses a shortname ("myPRlibrary"), I noticed something that others may
> find interesting.  Since in JSP 1.2, the emphasis seems to be to recommend
> making JSP pages into well-formed XML documents.

This is not correct. The spec doesn't make a recommendation for writing JSP
pages as well-formed XML documents, it only makes it possible. Both the
old JSP format and the new XML format (JSP Documents) are supported. The
XML format may make sense for some, and it's easier for tools to deal
with, but it is also more verbose. The old JSP format is likely the best
choice for most developers today.

> The spec shows an example
> of multiple taglib URIs in both standard JSP syntax and the recommended XML
> syntax:
>
>   <html>
>   <title>positiveTagLib</title>
>   <body>
>   <%@ taglib uri="http://java.apache.org/tomcat/examples-taglib"; prefix="eg"
> %>
>   <%@ taglib uri="/tomcat/taglib" prefix="test" %>
>   <%@ taglib uri="WEB-INF/tlds/my.tld" prefix="temp" %>
>   <eg:test toBrowser="true" att1="Working">
>   Positive Test taglib directive </eg:test>
>   </body>
>   </html>
>
> XML VIEW OF JSP PAGE:
>   <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page";
>   xmlns:eg="http://java.apache.org/tomcat/examples-taglib";
>   xmlns:test="urn:jsptld:/tomcat/taglib"
>   xmlns:temp="urn:jsptld:/WEB-INF/tlds/my.tld"
>   version="1.2">
>   <jsp:text><![CDATA[<html>
>   <title>positiveTagLig</title>
>   <body>
>
> Notice that if you don't use the more common URL-like syntax, it seems that
> you're required to add "urn:" to the xmlns definition.

No, this is a misunderstanding. The spec says that you must use the
"urn:jsptld:"
prefix if the value is a "relative path" (i.e. the path to the actual TLD
file) (section JSP.5.3.5) . If it's a symbolic name (short or in URL format),
you
should *not* use this prefix.

> So, while it may be
> easier to use a short, symbolic name, it may make sense to use the XML
> namespace approach with the usual URL approach, just to make it simpler for
> developers to not have to remember adding that extra part.  I also see that
> there's a version setting, so the Jakarta approach of appending a version to
> the end of the URI is not necessary anymore.  So, in the end, I'm thinking
> that the URL approach may make the most sense.  Also, for XML developers, it
> would be consistent with their expectations.

No, JSP 1.2 doesn't change anything in this respect. Short symbolic names
still rule :-)

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to