Enable Web application support
With Web Application support, 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.
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.
Turn on the Web Application option
Create a new web application
Click New Project on the Welcome screen or select .
From the Generators list, select Java Enterprise.
Name the new project, select a build tool, a language you want to use, and select the Web application project template.
Select the Create Git repository option to place the new project under version control.
From the JDK list, select the JDK that you want to use in your project.
If the JDK is installed on your computer, but not defined in the IDE, select Add JDK and specify the path to the JDK home directory.
If you don't have the necessary JDK on your computer, select Download JDK.
On the next step of the wizard, select the Java EE version to be supported.
From the Dependencies list, select Servlet.
Add the Web Application option an existing module
In the Project tool window (Alt+1), right-click the necessary module and select Add Framework Support.
In the dialog that opens, select Web Application and select a version of the Servlet specification.
If you want the deployment descriptor web.xml file to be created, select the Create web.xml checkbox.
Manage 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:
From the main menu, selector press Ctrl+Alt+Shift+S.
In the leftmost pane, select Modules or Facets.
In the pane to the right, select Web or Web (<ModuleName>).
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.
Manage application artifacts
To manage your artifact configurations, use the Project Structure dialog ( ).
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 a WAR file.
See also, Artifacts.