views:

168

answers:

2

I have a set of .tag files (for example a tag that renders a copyright notice) that I want to share across all my application contexts on my Tomcat application server.

I've only ever used them in a context's /WEB-INF/tags directory, referring to them via the taglib directive tagdir = "/WEB-INF/tags"

How can I make the tags available to all my contexts?

A: 

You probably have to put them in a directory where shared JARs go. The proper place depends on the version of Tomcat you're running. On versions 4.x and 5.x, it could be common/lib, because the files in that directory are visible to both the server and all contexts. On versions 6.x, it could be the /lib directory. Check your docs and try it.

duffymo
A: 

As an alternative to adding the tag files to all contexts, why not try giving an absolute path to the taglib-location in the taglib element in the web.xml:

  <taglib>
    <taglib-uri>mytaglib</taglib-uri>
    <taglib-location>/mytaglib.tld</taglib-location>
  </taglib>

You would need to define a common repository for all applications. I haven't tried it myself.

kgiannakakis