background image

Configuring Web Applications

<< Undeploying Web Modules | Perform the Servlet Mappings >>
<< Undeploying Web Modules | Perform the Servlet Mappings >>

Configuring Web Applications

asadmin undeploy
context-root
To use the Ant tool, execute the following command in the directory where you built and
packaged the WAR:
ant undeploy
Configuring Web Applications
Web applications are configured by means of elements contained in the web application
deployment descriptor.
The following sections give a brief introduction to the web application features you will usually
want to configure. A number of security parameters can be specified; these are covered in
Chapter 30, "Securing Web Applications."
In the following sections, examples demonstrate procedures for configuring the Hello, World
application. If Hello, World does not use a specific configuration feature, the section gives
references to other examples that illustrate how to specify the deployment descriptor element.
Mapping URLs to Web Components
When a request is received by the web container it must determine which web component
should handle the request. It does so by mapping the URL path contained in the request to a
web application and a web component. A URL path contains the context root and an alias:
http://
host:port/context-root/alias
Setting the Component Alias
The alias identifies the web component that should handle a request. The alias path must start
with a forward slash (/) and end with a string or a wildcard expression with an extension (for
example, *.jsp). Since web containers automatically map an alias that ends with *.jsp, you do
not have to specify an alias for a JSP page unless you wish to refer to the page by a name other
than its file name.
The hello2 application has two servlets that need to be mapped in the web.xml file. You can
edit a web application's web.xml file in NetBeans IDE by doing the following:
1. Select File
Open Project.
2. In the Open Project dialog, navigate to:
tut-install/javaeetutorial5/examples/web/
3. Select the hello2 folder.
Configuring Web Applications
Chapter 3 · Getting Started with Web Applications
89