Java Reference
In-Depth Information
opposed to one of
IDEA
's generic Java modules), the
IDE
is better able to support
your development with special features for that context.
You aren't required to work on web applications by defining them in a web
module. If a deployable web application in a
WAR
file is defined as a deployment
descriptor and a directory structure of Java sources, you could conceivably use
IDEA
to edit the files and then package the collection together into a web archive.
IDEA
, however, understands the structure and intent around the
WAR
file format
and provides a web module that enhances web application support.
11.1.2
Creating a new web module
Let's extend the
ACME
currency conversion tool by adding a web application
front end so that its functionality can be accessed by anyone with a web browser
on the corporate intranet. The first step in this process is to create a new web
module in your project, which can be accomplished by following these steps:
Select
File | New Module
from the main menu.
1
The first dialog in the
New Module
wizard appears and prompts you to
select the type of module to create. Click the
Web M o dul e
option, and
then click
Next
.
2
The next dialog prompts you to select a module name and a module
content root. Enter
ACMEWebApp
as the module name, and specify the
module content root to be a sibling directory to the currency converter's
Java module (for example, if the module you've been working on can be
found in the C:\Projects\CurrencyConverter directory, make this module
use the
C
:\Projects\
ACMEW
ebApp directory). Click
Next
.
3
The next dialog prompts you to select the application server for which
this web application is being written, but you don't have an application
server configured yet! Not to worry—this step can be reconfigured at a
later time, so defer the matter and click
Next
.
4
Specify the path and version of your web application's deployment
descriptor, the web.xml file that defines how this web application should
be deployed to a web application server. Because you're creating a new
web module,
IDEA
suggests the
WEB-INF
/web.xml file relative to your
module root. This default is appropriate, so click
Next
to continue.
5
You're prompted to specify a web resource directory. As the dialog sug-
gests, a web resource directory contains web-specific resources like
JSP
files, additional deployment descriptors, and so on that you want to be
6