Bill White wrote:
> What is the logic behind the WEB-INF directories? Why not just dump
> everything in a single folder and let the server sort it out?
>
The basic requirements for this are driven by the Servlet Specification, version
2.2, which you can download from JavaSoft's web site. The overriding goal is that
an application developer can *completely* describe an app, and all of its
consituent configuration files, web pages, JSP pages, and classes in a single
deployment JAR file that will run on any 2.2-compatible servlet container with
zero changes.
One of the consequences of this is that you have to specify where, within the
directory structure of the web application, the servlet container should look for
particular things -- otherwise, the app would not be portable. The most important
elements of this are:
WEB-INF/web.xml -- The deployment descriptor for your app
WEB-INF/lib -- All JAR files found here are included in the
class path for this application (so you can put libraries used
by your app here instead of requiring the system administrator
to add things to a global system class path)
WEB-INF/classes -- All unpacked classes here are also included
in the app's class path, so you don't even have to create JAR
files if you don't want to
So why put this stuff in a subdirectory? Well, consider the fact that the
top-level directory of an application is like the top-level directory of a web
server, and every file within it is normally accessible via a URL. Do you really
want people downloading your JAR files and classes, and decompiling them to see
how you did everything? Putting them under WEB-INF (which the servlet container
is specifically prohibited from making available for client access) avoids that.
A second issue relates to the way Java represents unJAR'd classes -- they have to
be represented in a directory hierarchy that matches the package naming
structure. You cannot put them all in a single directory anyway.
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html