IntelliJ IDEA 2021.3 Help

Enable Web application support

This topic discusses the features that become available when you turn on the Web Application option.

Prerequisites

For the Web Application option and associated features to be available:

  • You should be using the ULTIMATE Edition of IntelliJ IDEA. (The corresponding functionality is not available in the Community Edition.)

  • The Java EE: EJB, JPA, Servlets plugin must be enabled. (This plugin is bundled with the IDE and enabled by default.)

Overview of the features

When you turn on the Web Application option, IntelliJ IDEA:

  • Creates a web resource directory web with index.jsp intended as a starting page of your app and, optionally, a web app deployment descriptor WEB-INF/web.xml.

  • Creates a Web facet that lets you manage your deployment descriptors, web resource directories and your Java web source roots.

  • Creates an Exploded WAR artifact configuration.

  • Makes the Web tool window available.

If you turn on the Web Application option when creating a project or module and specify an application server, IntelliJ IDEA also creates a run/debug configuration for that server.

Turning on the Web Application option

You can turn on the Web Application option:

  • When creating a project or module (File | New | Project or File | New | Module). On the first page of the New Project or the New Module wizard, select Java Enterprise, and then select the Web Application checkbox under Additional Libraries and Frameworks.

  • For an existing module. In the Project tool window (View | Tool Windows | Project), right-click the module folder and select Add Framework Support. Then select the Web Application checkbox in the dialog that opens.

Managing deployment descriptors, web resource directories and Java web source roots

You can manage your web app deployment descriptors, web resource directories and Java web source roots in the Project Structure dialog:

  1. Open the Project Structure dialog (e.g. Ctrl+Alt+Shift+S).

  2. In the leftmost pane, select Modules or Facets.

  3. In the pane to the right, select Web or Web (<ModuleName>).

  4. On the page that opens in the right-hand part of the dialog:

    Deployment Descriptors. Form the list of deployment descriptors for your web app.

    Web Resource Directories. Specify the directories that contain your web app resources such as web pages, images, etc.

    Source Roots. Select the source roots that contain your web application Java classes (servlets, filters, managed beans, etc.).

    For more info, see Web facet page.

Managing application artifacts

To deploy your application to a server, you need an application artifact. For Java web applications, IntelliJ IDEA provides the following artifact formats:

  • Web Application: Exploded. This is a decompressed Web application archive (WAR), a directory structure that is ready for deployment onto a web server.

  • Web Application: Archive. This is, obviously, a WAR file.

To manage your artifact configurations, use the Project Structure dialog (File | Project Structure | Artifacts).

Basic artifact configuration

See also, Artifacts.

Last modified: 01 August 2022