Configuring web applications with the web deployment descriptor editor

You can configure the deployment descriptor for web projects that have Web 2.5, Web 3.x, or later modules in a web deployment descriptor editor. For Web 2.4 and earlier modules, use a source XML editor.

About this task

When you create a Web 2.2, 2.3, 2.4, 2.5, 3.0, or 3.1 web project, the New web Project wizard optionally places a web.xml file in the project WEB-INF directory. The web.xml file is optional for Web 3.0 and Web 3.1 projects. This file specifies deployment information for modules that are created in the web development environment.

The editor that you use to specify deployment information in the web.xml file depends on the specification version of the web module.

Procedure

  • For Web 2.2, 2.3 or 2.4 modules, use a source XML editor to edit web.xml file for these modules.
  • For Web 2.5, 3.0, or 3.1 modules, use a web deployment descriptor editor to construct the deployment descriptor for your web application rather than editing the source. Though the web deployment descriptor editor provides a source page for the web.xml file (from the Source tab), by using the editor is easier and introduces fewer errors. As you work within the editor, the web.xml file is updated automatically.
    1. Open the web.xml file in a web deployment descriptor editor.

      Double-click the web.xml file or double-click the Deployment Descriptor icon in the Enterprise Explorer view.

    2. Configure the web deployment descriptor for your web project.
  • If a Web 3.x, or later web project requires a web deployment descriptor, generate a deployment descriptor stub.

    Web 3.x, or later web projects do not require a web.xml file because deployment information is managed by using annotations. However, you can generate a deployment descriptor stub. Right-click your project and select Java EE > Generate Deployment Descriptor Stub.