5

I'm trying to implement a sitemesh decorator in my site. The example on their site has a full URI linking to their site for the taglib part of the decorator file:

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>

Does this mean that my site is reliant on being able to access that site? Because i want to deploy inside an intranet which can't access the outside world.

Thanks

Chris
  • 39,719
  • 45
  • 189
  • 235

3 Answers3

8

No, it does not. The URI declared in taglib will be resolved locally as long as it matches the URI declared in tag library descriptor (or in your web.xml, depending on what JSP version your container implements).

See Java EE tutorial for more details.

ChssPly76
  • 99,456
  • 24
  • 206
  • 195
  • When you say 'resolved locally' do you mean that if i have the TLD file in my LIB folder i'll be fine? – Chris Nov 27 '09 at 00:07
  • 1
    TLD doesn't belong in `lib`, it should either be in `/WEB-INF` or in `/META-INF` of the jar providing tags. But yes, you'll be fine. – ChssPly76 Nov 27 '09 at 00:11
  • Awesome, i opened the JAR in 7-zip and it does indeed have those files in the meta-inf folder. You've set my mind at rest. Thanks – Chris Nov 27 '09 at 01:52
  • PS: The jar i looked in was 'sitemesh-2.4.2.jar' – Chris Nov 27 '09 at 01:54
  • @ChssPly76 I finally just got done resolving a similar issue.. and for the life of me could not find the correct documentation for Java SE 7... can someone point me to a more official source than http://www.di.unipi.it/~ghelli/didattica/bdldoc/A97329_03/web.902/a95882/taglibs.htm? What would be the correct process for finding the correct documentation for this? – SgtPooki Oct 17 '13 at 04:27
4

No. The URI is a Universal Resource Identifier, it is NOT a locator (URL). This means that the URI is used to uniquely identify each taglib in an internal registry of taglibs, much like a key is used to set/get values from a HashMap or Hashtable in Java.

According to the web application spec from Sun, resolving the URIs to actual tag libraries that can be loaded/called by the application takes place in the following order:

  1. Check the web.xml file for matching taglib tags that have the given URI in them and then follow the taglib-location tag to actually load the TLD.
  2. If no match with #1 was found, recursively check the META-INF directory of all the JARs in the application for TLDs that contain the URI that was specified.
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
0

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" >

where the uri attribute value resolves to a location the container understands and the prefix attribute informs a container what bits of markup are custom actions.

Lucas Zamboulis
  • 2,494
  • 5
  • 24
  • 27
Chinna
  • 11