Configuring Web applications using the Web deployment descriptor editor
When you create a Web project, the New Web Project wizard places a web.xml file in the project's WEB-INF directory. To open the web.xml file, double-click the Web Deployment Descriptor file in the J2EE Navigator view. The Web deployment descriptor editor opens in the editing pane.
It is recommended that you use the tabbed pages (views) to construct the deployment descriptor for your Web application. Even though the Web deployment descriptor editor does provides a source page of the web.xml file (from the Source tab), using the tabbed pages is easier and introduces fewer errors. As you make changes on these tabbed pages, the web.xml file is updated automatically. For instance, when you use the New Servlet wizard to create a servlet in a Web project, the appropriate servlet entry is automatically inserted into the web.xml file.
In addition to the configuration information in the web.xml file, you can also use this editor to edit other deployment descriptors in the Web project, including information on bindings and IBM extensions (ibm-web-bnd.xmi and ibm-web-ext.xmi files).
To edit the deployment descriptor, click the tabbed pages to locate attributes that you wish to add, edit or remove. In addition, the sections in the Overview page contain links to existing elements of the deployment descriptor. Click the links to open the appropriate editor page to make updates or additions.
For help on individual attributes represented by fields and other controls in the editor, click F1.
The Web deployment descriptor editor
The Web deployment descriptor editor lets you specify deployment information for modules created in the Web development environment. The information appears in the WEB-INF/web.xml file. Note that you use the Web deployment descriptor to set deployment descriptor attributes. You do not use it to manipulate Web resource content.
The web.xml file for a Web project provides information necessary for deploying a Web application module. It is used in building a WAR file from a project. Whenever you create a new Web project, a minimal web.xml file is automatically created in WEB-INF under the project's Web content folder.
The Web deployment descriptor editor is dynamic and includes many tabbed pages (views) that represent various properties and settings in the deployment descriptor. For example, you can click the Servlets tab to display the Servlets and JSPs page. From this page, you can add or remove servlets and JSPs Web application. The Web deployment descriptor editor includes the following tabbed pages, each of which you can edit:
Provides a quick summary of the contents in the Web deployment descriptor and lets you add, remove, or change the contents.
Lets you create a new servlet, add an existing servlet or JSP file to the deployment descriptor, or remove the selected servlet of JSP file from the deployment descriptor.
Lets you create a new filter, add an existing filter to the deployment descriptor, or remove the selected filter from the deployment descriptor.
Lets you create a new listener, add an existing listener to the deployment descriptor, or remove the selected listener from the deployment descriptor.
Lets you define security roles and security constraints.
Lets you add or remove the name of a Web application environment variable to the deployment descriptor.
lets you add or remove the name of an enterprise bean reference to the deployment descriptor. There are 5 types of references you can define on this page:
EJB Local (J2EE 1.3 only)
Resource Environment (J2EE 1.3 only)
JSP Tag Library
Lets you add or remove welcome and error page to the deployment descriptor. Also allows you to define the login-config element.
Lets you add or remove servlet context initialization parameters for a Web applications. The context parameters apply to all servlets within the application.
Lets you add or remove mappings between the extension types and MIME types (such as text/plain). File extensions are strings that describe an extension without the dot (.) delimiter (for example, txt).
Lets you specify settings for WebSphere extensions (such as enabling reloading).
Lets you edit the web.xml source directly.
Editing the XML source directly is not the recommended method for editing the deployment descriptor. The best way to build deployment descriptor files is to edit the multiple tabbed pages. As you specify deployment information in these tabbed pages, the editor automatically incorporates the appropriate XML tagging.
In addition to the configuration information in the web.xml file, other deployment descriptors in a Web project include the following information:
Binding information — information is required by the application server to bind the deployment information specified in the application to a specific instance. For example, it may map a logical name of an external dependency or resource to the actual physical JNDI name of the resource. It also may map security role information to a set of groups or users.
IBM binding and extensions information (ibm-web-bnd.xmi and ibm-web-ext.xmi files) — additions to the standard descriptors for J2EE applications, Web applications, and enterprise beans. The extensions enable Enterprise Edition or legacy (older) systems to work in the current WebSphere Application Server environment. They are also used to specify application behavior that is vendor-specific, undefined in a current specification, or expected to be included in a future specification.
If you import a WAR file into an existing Web project, you can include the deployment descriptor files included in the WAR file as the Web project's new deployment descriptor. Any specific deployment information already defined in these files is used when deploying the updated Web application.
The web.xml file can be updated automatically to reflect changes to your Web project. For instance, when you use the New Servlet wizard to create a new servlet in a Web project, the wizard places the appropriate servlet entry into the web.xml file.