Enabling Web Application Support
You can enable Web application development support when creating a project or module. You can as well do that for an existing project or module.
In all such cases, IntelliJ IDEA creates
1) the folder web
with index.jsp
intended as a starting page of your application and,
optionally, WEB-INF/web.xml
application deployment descriptor,
2) a Web facet which, among other things, lets you manage
your deployment descriptors and
3) an exploded WAR artifact configuration.
Additionally, the Web tool window becomes available for
working with the Web part of your application.
- Enabling Web app development support when creating a project or module
- Enabling Web app development support for an existing project or module
- Managing deployment descriptors
- Managing application artifacts
Enabling Web app development support when creating a project or module
-
Do one of the following:
-
If you are going to create a new project:
click Create New Project on the Welcome screen or
select File | New | Project.
As a result, the New Project wizard opens.
-
If you are going to add a module to an existing project:
open the project you want to add a module to, and
select File | New | Module.
As a result, the New Module wizard opens.
-
If you are going to create a new project:
click Create New Project on the Welcome screen or
select File | New | Project.
- On the first page of the wizard, in the left-hand pane, select Java. In the right-hand part of the page, specify the JDK that you are going to use.
-
Under Additional Libraries and Frameworks, select the Web Application check box.
Select the version of the Servlet specification to be supported from the Versions list.
If you want the deployment descriptor
web.xml
file to be created, select the Create web.xml check box. - Specify the name and location settings. For more information, see Project Name and Location or Module Name and Location.
Enabling Web app development support for an existing project or module
- Open the Project tool window (e.g. ).
- Right-click the project or the module folder and select Add Framework Support.
- In the left-hand pane of the Add Frameworks Support dialog that opens, select the Web Application check box.
-
In the right-hand part of the dialog, select the version of the Servlet specification to be supported
from the Versions list.
If you want the deployment descriptor
web.xml
file to be created, select the Create web.xml check box. - Click OK in the Add Frameworks Support dialog.
Managing deployment descriptors
Open your Web facet settings. For corresponding instructions, see Changing Facet Settings.
Your application deployment descriptors are shown in the area under Deployment Descriptors. Use:
-
(Alt+Insert) to create a new
web.xml
deployment descriptor. (You can do that only if noweb.xml
is currently associated with your application.) - The Add Application Server specific descriptor button to create an application server-specific deployment descriptor.
-
(Enter) to replace the selected descriptor file with a different one.
-
(Alt+Delete) to remove the association of the selected descriptor with your application and, optionally, to physically delete the corresponding file.
For more information, see Web, EJB and Java EE Application Facet Pages.
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. If you go there now (e.g. ), you'll see that there is already one exploded WAR artifact configuration created for you by IntelliJ IDEA.
