2 Structure of Web Applications
As mentioned earlier, a Web application has a standardized format and is portable
across all compliant Web or application servers. The top-level directory of a Web
application is simply a directory with a name of your choosing. Within that directory,
certain types of content go in designated locations. This section provides details on
the type of content and the locations in which it should be placed.
Locations for Various File Types
Figure 1??“1 shows a representative example of a Web application hierarchy. For a
step-by-step example of creating your own Web application, download the app-blank
Web app from http://volume2.coreservlets.com/ and follow the instructions in Section
1.6 (Building a Simple Web Application).
Figure 1??“1 A representative Web application.
JSP Pages
JSP pages should be placed in the top-level Web application directory or in a subdirectory
with any name other than WEB-INF or META-INF. Servers are prohibited from serving
files from WEB-INF or META-INF to the user. When you register a Web application
(see Section 1.3), you tell the server the URL prefix that designates the Web app and
define where the Web app directory is located. It is common, but by no means mandatory,
to use the name of the main Web application directory as the URL prefix. Once
you register a prefix, JSP pages are then accessed with URLs of the form http://host/
Chapter 1 ?– Using and Deploying Web Applications 6
webAppPrefix/filename.
Pages:
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33