Project Explorer view and Web development
The Project Explorer view is customized for Web developers as an alternative to the Resource perspective's Navigator view. The Project Explorer view is the default view in the Web perspective.
All operations available within the Resource perspective's Navigator view are also available in the Project Explorer view through Workbench or pop-up menus. The following notable features are available in the Project Explorer view:
- VCM (version control management) information can be toggled on and off from the Preferences page (Window > Preferences > Workbench > Label decorations)
You can drag and drop files from Windows Explorer or the desktop into the Navigator view.
- View filtering is supported by selecting Filters from the Navigator view Menu button. Resources can be filtered by name, project type or working set. Files beginning with a period are filtered out by default.
- To change the view root, select Go Into from the project pop-up menu.
- The status line shows the full path of the selected resource.
- Dragging a .java file from the Navigator view into a JSP file will insert a usebean tag, the same behavior that is exhibited when a .class file is dragged into a JSP file.
- Errors and warnings on resources (including Java, HTML/JSP, and Links Builder errors and warnings) are indicated with a red error
or yellow warning
next to the resource with the error, as well as the parent containers up to the project. This applies for all project types, not only Web projects.
- Items available from the New cascading menu in the project pop-up menu are context sensitive. All menus will have Project and Other options.
Organization of the Project Explorer view
The Project Explorer view shows a custom view of a dynamic Web project. The following are some of the notable top-level objects that appear beneath the project node (based on default folder names):
Web Site Navigation - This configuration file only exists if you choose to use the Web Site Designer feature (a default setting) when you create a Web project. Double-click this file to open the 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 pop-up menu to open the file with a different editor.
Underneath the Deployment Descriptor are placeholders object that are reserved for the creation of Servlets, Servlet Mappings, Filters, Filter Mappings, References, Security (constraints and roles) and Listeners. You can create instances of these objects by right clicking on an object and selecting New from the pop-up menu.
Web Diagram - This file and associated wizard enables you to construct a diagram of a Web application by clicking on objects in a palette.
JavaSource - This node displays Java resources within the project. If the project contains a single Java source folder, the packages and classes (for example, servlets, beans) within the source folder will be shown directly beneath the JavaSource folder node. If the project contains multiple source folders, each source folder will appear beneath the Java JavaSource folder and can be expanded to show their packages and classes. A default folder named gen/src is created when you create a Web project.
Note: Though the default name given to the folder is JavaSource, you can change the name in the Preferences page by selecting Window > Preferences > Web Tools > New J2EE Project.
- Libraries - This folder contains the library JAR files defined in the project properties. Three types of JAR files are shown:
- JAR files included in the project's WebContent/WEB-INF/lib directory
- JAR files external to the project, such as j2ee.jar and rt.jar
- Project libraries, which are special references to a Java project
When a Web project is exported, a JAR file is automatically created from the Java project to be used by the Web application during runtime. Libraries are shown in classpath order. By default, only the JAR files contained within the project are shown. You can also display external JARs and project libraries by selecting Show Referenced Libraries from the Navigator view's Menu button
.
- imported_classes folder - This folder can be created during a WAR import, and contains class files that do not have accompanying source. The imported_classes folder is a Java classes folder; Java classes folders can also be created using the Web project Java Build Path properties page.
You can drag and drop class files from the Windows Explorer or desktop to the imported_classes folder in the Navigator view.
Web content folder - This folder contains items to be published to the server. By default, this folder will be named WebContent for newly created static and dynamic Web projects.
Note: You can change the name in the Web page of the project's Properties dialog. In a dynamic Web project, changing the folder name will update the Java build output directory. You can change the preference for the default folder name to be applied when creating new Web projects by selecting Window > Preferences > Web Tools > New J2EE Project.
- MET-INF - This directory contains the MANIFEST.MF file, which is used to map class paths for dependent JAR files that exist in other projects in the same Enterprise Application project. An entry in this file will update the run-time project class path and Java build settings to include the referenced JAR files.
- Theme - The suggested directory for cascading style sheets and other style-related objects.
- WEB-INF - The directory where supporting Web resources for a Web application are kept (for example: .xmi files, .xml files, and web.xml.) Note that double-clicking on the web.xml file has the same effect as double-clicking on the Deployment Descriptor: it opens the Web Deployment Descriptor editor.
Related concepts
The Web deployment descriptor editor