It's not a secret anymore!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes taglib-uri Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "taglib-uri" Watch "taglib-uri" New topic


Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
Can taglib-uri be relative when taglib-location refers to a jar file. can anybody give the clarification and reference.
Raji Ram
Ranch Hand

Joined: Aug 22, 2002
Posts: 46
From Manning Book:
"taglib-uri is a user defined uri.Its value can be absolute uri, root-relative uri or non root-relative uri."
As far as I understood,
You can name the taglib-uri whatever you want in the web.xml. The taglib-location is all that matters.
the uri specified in the jsp file should be given the same name as the one specified in the taglib-uri.
The engine will look at the mapping for the uri in the web.xml.If the mapping for the uri is found, the corresponding taglib-location is seen and that value is considered to be the location of the tld file. It can specify either the tld file or the jar file that contains the tld file.
If no mapping is found, then it would try to resolve the location using the uri specified in the jsp file. If this uri is an absolute uri, it will give a translation time error.
I hope this is clear.
Correct me if I am wrong.
Good Luck!

Regards,<br />Raji.
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Just adding to what Raji has said, the JSP engine builds a taglib mapping from <taglib> mappings in the deployment descriptor, as well as <uri> mappings in any jar'd taglib descriptors. For taglib descriptors, the uri is specified in the <uri> tag, and the location is the physical location of the .tld file.
When the url is requested, and the engine fails to find a match in it's taglib map, then it tries to resolve the location based on the format of the requested url. If the requested url is absolute, however, then a compile-time error is thrown.
The taglib uri can be anything you want, but if a match is not found, and the requested url was absolute, then an error is thrown.
Hope this helps, 'coz I've just read it back to myself and realised that I haven't added much value to what Raji has already said
I agree. Here's the link:
subject: taglib-uri
It's not a secret anymore!