Now that we’ve considered each of the pieces that constitute our
ListManager web application, we’ll look at how those pieces are put
together into a web application WAR file. For completeness, we’ll
include all the servlets and JSP pages from this chapter, not just the
ones that implement the mailing list manager. In order to do this, we
Write a web.xml file that configures all the servlets
Arrange that configuration file—along with the servlet implementation classes, JSP pages, and related files—in their correct places in a directory hierarchy
Zip them all up (with the jar tool) to create a WAR file
Recall from the start of this chapter that we used these commands to compile the servlet classes and create the WAR file:
javac -d WEB-INF/classes/ *.java jar cMf je3.war \ index.html *.jsp *.jspx ListManager/*.jsp \ WEB-INF/web.xml WEB-INF/tags/*.tag WEB-INF/classes
We’ll consider the directory hierarchy of the web application first, and then look at the web.xml file.
Our je3 web application is structured as follows:
This is the root directory for the application. The
servlet container will map a file
in this directory to a URL like this:
The default file served for the URL “je3/”. This is just a plain HTML file that contains links to the various examples contained in the web application.
hello3.jspx examples go here.
A directory for ...