The default directory structure in the Web project adheres to
the J2EE specification for Web modules. (Web modules are also known as
Web applications, in servlet programming.) This specification defines a project
directory structure that specifies the location of WebContent files, class
files, class paths, deployment descriptors, and supporting metadata. The Dynamic
Web Project uses the following directory structure:
- Web Site Navigation - Double-click this file to open Web Site Designer,
which includes a Navigation view and a Details view.
- Web Deployment Descriptor - This file corresponds to the WebContent/WEB-INF/web.xml
file. You can double-click to open the file in the deployment descriptor editor,
or select Open With from its context menu to open the file with a different
editor.
- Java Resources - This node displays Java resources within the project.
Each source folder appears beneath the Java Resources folder
and can be expanded to show their packages and classes.
- WebContent - The WebContent folder contains the contents of the
WAR file that will be published to the server. It contains all the Web resources,
including HTML files, JSP files, and graphics needed for the application.
Any files not under WebContent are considered development resources
(for example .java and .sql files) and will not be deployed when the project
is unit tested or published.
- WebContent/theme - The WebContent/theme folder contains cascading
style sheets and other style-related objects.
- WebContent/WEB-INF - The WebContent/WEB-INF folder contains the
supporting Web resources for a Web application, including the web.xml deployment
descriptor file and the classes and lib directories. The web.xml file contains
general information about the Web application, including servlet mappings,
security information, and the welcome page. The ibm-web-bnd.xml file contains
bindings to references used at the Web module level as defined by IBM. The
ibm-web-ext.xml file is used by WebSphere Application Server to support additional
options beyond the J2EE specification such as reloading intervals and the
default error page. The struts-config.xml file is the deployment descriptor
for a Struts application to initialize its own resources, such as: ActionForms,
to collect input from users, ActionMappings, to direct input to server-side
Actions, and Action Forwards, to select output pages.
- WebContent/WEB-INF/classes - The WebContent/WEB-INF/classes folder
contains servlets, utility classes, and the Java compiler output directory.
The classes in this directory are used by the application class loader to
load the classes. Folders in this directory will map package and class names.
The .class files are automatically placed in this directory when the Java
compiler compiles the source files from the source directory. Any files placed
directly in this directory will be deleted by the Java compiler when it runs.
- WebContent/WEB-INF/lib - The WebContent/WEB-INF/lib folder supports
.jar files that your Web application references. Any classes contained in
these .jar files will be available for your Web application.
In the course of development, the web.xml and the struts-config.xml
files are updated automatically to reflect changes to your Web project. For
example, when the Web Interaction wizard is used to create a Web interaction
in a Web project, it automatically places the appropriate servlet entries
into the web.xml file. When you are testing your application in the WebSphere
Test Environment, and the web.xml file has been updated, the change is not
always recognized. In this case you need to restart the project. To do this
go to the Server view, right-click on the server, select Restart
Project and then select the project. Watch the console view for
a message indicating that the application has been started.