O'Reilly logo

JavaServer Faces by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Placing Java Class Files in the Right Directory

The WEB-INF directory contains files and subdirectories for other types of resources used by the application. Files under this directory aren’t directly accessible to a browser. Two WEB-INF subdirectories have special meaning: lib and classes. The lib directory contains JAR files with Java class files, for instance JavaBeans classes, custom action handler classes, and utility classes. The classes directory contains class files that are not packaged in JAR files. The web application automatically has access to all class files in the lib and classes directories (in other words, you do not have to add them to the CLASSPATH environment variable).

If you store class files in the classes directory, they must be stored in subdirectories mirroring the package structure. For instance, if you have a class named com.mycorp.util.MyUtils, you must store the class file in WEB-INF/classes/com/mycorp/util/MyUtils.class. Another type of file that can be stored in the classes directory is the type of a resource properties file containing localized text, as described in Chapter 11.

The WEB-INF directory can also contain other directories. For instance, a directory named tlds is by convention used for tag library Tag Library Descriptor (TLD) files when they are not packaged in JAR files.

During development it’s more convenient to work with the web application files in a regular filesystem structure instead creating a new WAR file every time something ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required