On Fri, 4 Oct 2002, shanmugampl wrote:

> Date: Fri, 04 Oct 2002 09:46:32 +0530
> From: shanmugampl <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
>      [EMAIL PROTECTED]
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: Shared JSP taglibs
>
> I dont think that this solution will solve the problem. It says that
> instead of copying the tld files,  make them as a jar and put it in the
> WEB-INF/lib directory. Still i will have to duplicate the tld files
> which is not desired.

I don't have this problem -- but maybe it is because of the way that I
have my development environment organized.

I separate the build process such that each tag library is built
separately - and the output is a JAR file which includes the TLD.  Now,
whenever I want to use this tag library in a webapp, all I need to do is
grab that JAR file and drop it into /WEB-INF/lib.

> I have this same problem. What i want to know is
> that, like having the classes in shared jar(<Tomcat home>/shared/lib/),
> can i move my tld files outside my webapp and have it at a single place
> and access it across my contexts
>

In my experience, the (small) memory savings of putting classes into
/shared/lib (or /common/lib) is not worth the hassles it brings:

- All the webapps running in this Tomcat installation must
  share the same version of the tag library (or whatever -- it's
  not just limited to these), so you have to upgrade them all
  together in lockstep.

- If your shared library wants to access application-specific classes
  that are only available in /WEB-INF/classes or /WEB-INF/lib, you
  have to program them specifically to access those classes via the
  thread context class loader.

- You are depending on a non-portable feature of Tomcat (no concept
  of shared library directories is required by any of the Java specs;
  although most servers offer something like it, they are all
  implemented differently).

My advice would be to make your webapps as self-contained and
independently replaceable as possible.  Sharing classes across webapps is
not the way to do this.

> shan

Craig

>
> Craig R. McClanahan wrote:
>
> >Tomcat 4.1 doesn't have any "known to the container" mechanisms built in,
> >but there is a strategy you can use (also portable) to avoid having to
> >separately copy TLDs into your webapps.  You can put TLD files in the
> >"META-INF/tlds" directory of a JAR file in /WEB-INF/lib (presumably the
> >JAR containing your tag library implementation classes), and Tomcat will
> >automatically recognize it.  In fact, if your pages use the same URI that
> >you specify in the <uri> element in the TLD, you don't need to declare
> >them in the web.xml file either.
> >
> >Now, using a tag library is simply a matter of dropping a JAR file into
> >/WEB-INF/lib.
> >
> >Craig
> >
> >
> >
> >On Thu, 3 Oct 2002, Tim Moore wrote:
> >
> >
> >
> >>Date: Thu, 3 Oct 2002 18:11:16 -0400
> >>From: Tim Moore <[EMAIL PROTECTED]>
> >>Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> >>To: [EMAIL PROTECTED]
> >>Subject: Shared JSP taglibs
> >>
> >>>>From the JavaServer Pages 1.2 Specification:
> >>
> >>JSP.7.3.5 Implicit Map entries from the Container
> >>The container may also add additional entries to the taglib map. As in
> >>the previous
> >>case, the entries are only added for URIs that are not present in the
> >>map. Conceptually
> >>the entries correspond to TLD describing these tag libraries.
> >>These implicit map entries correspond to libraries that are known to the
> >>container, who is responsible for providing their implementation, either
> >>through
> >>tag handlers, or via the mechanism described in Section JSP.7.3.9.
> >>
> >>Does Tomcat 4.1.x support this in any way? If so, can I add my own
> >>taglibs to the map of known taglibs?  We have several webapps running on
> >>the same server that use the same tag libraries.  Currently, we have the
> >>tag handler classes in a shared JAR, and copy the TLD files into each
> >>webapp.  If I could avoid having to do the latter, that would be nice.
> >>:-) I haven't seen anything to indicate that it's possible, but if it
> >>is, that would be cool!
> >>--
> >>Tim Moore / Blackboard Inc. / Software Engineer
> >>1899 L Street, NW / 5th Floor / Washington, DC 20036
> >>Phone 202-463-4860 ext. 258 / Fax 202-463-4863
> >>
> >>
> >>--
> >>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> >>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >>
> >>
> >>
> >>
> >
> >
> >--
> >To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> >
> >
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to