Allton Paul wrote:
> >
> > There is no mechanism to share TLDs across web apps. The
> > whole idea is that a
> > web app should be a self-contained component that can be
> > installed on any
> > servlet container, and it will "just work". Although this
> > ideal is not
> > completely met yet (primarily due to buggy servlet
> > containers), it is pretty
> > close to the case.
> >
>
> I agree in principal, the whole point of having a WAR file is so that its
> easy to deploy elsewhere. But in reality it means you have to either put
> everything into one webapp, which would quickly get out of hand if you have
> a lot of pages.
>
> Or if you split into seperate webapps then you are forced to have a copy of
> the .jar and .tld's in each one, which sounds like it will lead to version
> control nightmare ....
>
System administrators have to deal with this kind of thing all the time -- it's
by no means unique to web apps. All it takes is some discipline and the use of
scripts rather than manual commands to do updates.
You also run into the same issue with development environments. Consider the
case where you're using Struts to build three different web apps. What I do is
set up my directories like this:
DEVELOPMENT-HOME/
jakarta-struts/ <-- Struts distribution
my-app-1/ <-- My App 1 source code
my-app-2/ <-- My App 2 source code
my-app-3/ <-- My App 3 source code
BUILD-HOME/
my-app-1/ <-- My App 1 WAR directory structure
my-app-2/ <-- My App 2 WAR directory structure
my-app-3/ <-- My App 3 WAR directory structure
And I use Ant build scripts (the same way that Struts itself is built -- if
you're not using Ant you are working way too hard!) for the three individual
apps that always copy the appropriate stuff from "../jakarta-struts/lib" every
time I build. In all cases, the build occurs into separate build directories
that have the exact structure of a web application. These directories are
mapped as <Context> entries in Tomcat.
Now, I can rebuild a particular app from scratch by simply deleting the
BUILD-HOME/my-app-2 directory (for example), and running the build script for
my-app-2. I'm always guaranteed to pick up the current version of the Struts
files, and they will always be in the right place -- so it's very difficult to
make a mistake.
For more on my recommended approach to organizing development of web
applications (including those that use Struts), see the Application Developer's
Guide that is included in the documentation directory of the Tomcat 3.2
distribution.
Craig