Web projects

Use web projects to create and maintain the resources for your web applications. You can create web projects to manage content-based web applications that contain resources such as images and HTML files. You can also create web projects that contain dynamic files, such as JavaServer Pages or servlets.
The structure of a web project mirrors the web application that is created from the project. The main project folder contains all of the development objects that are related to the web application.
Note: In the Enterprise Explorer view, web projects are filtered into folder nodes to customize the display of web resources for easy management during development. For more information about this filtered structure, see Enterprise Explorer view and web development.
The following table lists and describes the default elements that are located in the web project folder hierarchy.
Table 1. Contents of the main web project folder
Development object Description
Web Deployment Descriptor The standard web application deployment descriptor file (web.xml). This file describes how to deploy a module by specifying configuration and container options. A deployment descriptor file is automatically generated when you create a web project. This configuration file is used to run a servlet on an application server. If your web application does not contain any servlets, filters, or listeners, you can clear the Generate web.xml deployment descriptor check box in the Web Module configuration page when creating your web project. If you need to generate a deployment descriptor file at a later time, right-click your web project and select Java EE > Generate Deployment Descriptor Stub.
JavaSource This folder contains the Java source code for classes, beans, and servlets. When these resources are added to a web project, they are automatically compiled and the generated files are added to the WEB-INF classes directory. The contents of the source directory are not packaged in web application archive (WAR) files unless an option is specified when a WAR file is created.
imported_classes Contains class files that do not have accompanying source. This Java classes folder is created while importing a WAR file. You can also use the Java Build Path properties page to create Java classes folders.
WebContent Contains all of the web resources. For example, the HTML files, JSP files, and image files that are used to create a web application. If files are not placed in this directory, or in a subdirectory, the files are not available when the web application runs on a server. The folder structure represents the contents of the WAR file to be deployed to the server. Any files that are not in the WebContent folder are considered to be development-time resources, such as .java files, .sql files, and .mif files. These files are not deployed when the project is unit tested or published.
META-INF Contains the MANIFEST.MF file that is used to map class paths for dependent JAR files that exist in other projects in the same Enterprise Application project. An entry in the MANIFEST.MF file updates the runtime project class path and Java build settings to include the referenced JAR files.
Themes Contains cascading style sheets and other style-related objects.
WEB-INF Contains the supporting web resources for a web application, including the web.xml file and the classes and lib directories. The structure of this directory is based on the Sun Microsystems Java Servlet 2.5 and 3.0 Specifications.
/classes Contains servlets, utility classes, and the Java compiler output directory. The application class loader uses the classes in this directory to load the classes. Folders in this directory map package and class names. For example: /WEB-INF/classes/com/corp/servlets/MyServlet.class. The .class files are automatically placed in this directory when the Java compiler compiles Java source files located in the Java Resources directory. Do not place any .class files directly into the /classes directory since they are deleted by the Java compiler when it runs.
/lib Contains the supporting JAR files that are referenced by your web application. Your web application can use any classes in .jar files that are stored in this directory.
Libraries This folder mirrors the content of the /lib folder. It contains the supporting JAR files that are referenced by your web application and Web Library Projects. Web Library Projects are virtual JAR files that are not physically located in the web project. Instead, these projects are associated with Java projects in a different location within your workspace. Web Library Projects are packaged with your project when you export the WAR file from your web application.
Note: A library entry on the Java build path remains there unless the actual JAR file is deleted from the WEB-INF/lib folder. If you remove a library path entry but not the JAR file, the library entry is automatically added to the path again.

Features

Web projects contain the following features:

Feedback