8.3. Directories in the Work Area

When your webapp is complete, the packaging of the source and distribution archive depends on a canonical layout of directories and files. This section discusses where to put them in order to create portable, standard packages.

The standard layout of files in the build environment of a WAF application follows the guidelines set out in the Tomcat Application Developer's Guide (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/index.html), which are based on the Servlet specification.

binder/

The name of the directory you choose to hold your application source and build files. Our example application is a note binder, so we call our directory binder.

binder/pdl/

The PDL code for this application. As is common with Java code, it is organized into packages.

binder/pdl/com/example/binder/Binder.pdl
binder/pdl/com/example/binder/Note.pdl

binder/sql/

Custom SQL for your application. Ordinarily developers will autogenerate their SQL from PDL, but if a custom schema is required, SQL files may be placed here to override automatic SQL generation. See Chapter 9 Persistence Tutorial for more information. Files in this directory are organized by relational database.

binder/src/

The source code and resources of your application reside here. As with library code, the source is organized in packages. For example:

binder/src/com/example/binder/Binder.java
binder/src/com/example/binder/Note.java
binder/src/com/example/binder/NoteCollection.java
binder/src/com/example/binder/BinderServlet.java

binder/web/

The place for files that will become part of your webapp's document root, such as JSPs, images, and XSL templates. Once deployed, these files will be directly addressable via HTTP.

binder/web/logo.png
binder/web/note.jsp

binder/web/WEB-INF/

These are other resources such as compiled Java classes, property files, and resource bundles that are used internally by your application code. Such files are not addressable.

binder/web/WEB-INF/classes, binder/web/WEB-INF/lib

Classes and jars that your application code uses go in classes/ and lib/, respectively. When you compile and produce your webapp, these jars and classes will go with it.