• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

taglib directive uri= abs question

 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
what i wonder is why it is not possible to pass a real uri in the taglib directive uri attribute like:
<%@ taglib prefix="commageneus" uri="http://www.somewhere.sometaglib.org/taglib_sample"
assuming this absolute uri actually exists...
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, but it is possible to use an absolute URI However, it is not possible to use an absolute URL
A slight digression. A Uniform Resource Locator (URL) locates a resource such as an HTML file. If you'd stick it into a java.net.URL class, you would expect to find something there. A Uniform Resource Identifier (URI), on the other hand, merely identifies some resource. It is a fancy label, no more. Sticking it into a java.net.URL is meaningless; in fact, the resource being identified does not even have to be a file. (Having said that, out of courtesy people often put some kind of document at the location pointed to when the URI is interpreted as an URL).
Why create URIs that look so confusingly like URLs? Well, it helps prevent name clashes for a start. If you own a domain or a host(name), you can safely use URIs based on that without having to wonder whether anyone else has ever used the same URI. Also, it gives you a sensible URL to stick your documentation
Back to the somewhat flippant answer I started out with. As you probably know, as of JSP 1.2, the container scans all the *.tld files it can find at startup. These *.tld files may specify a URI uniquely identifying the tag library; if they do, you can use this URI in your <@taglib> tag without ever mapping the tag library in the web.xml file. So in the literal sense, yes, you can save yourself some work using absolute URIs. It just doesn't work the way you thought it would
Hope this helps
- Peter
PS. "comma geneus"? That doesn't look like a real name. Please have a look here and change your display name. Please accept my apologies if I'm merely showing cultural prejudice rather than an eagerness to maintain a professional appearance...
[ November 09, 2002: Message edited by: Peter den Haan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic