Step 4: Deploy Your Application
Each Web application must have its own ServletContext. The ServletContext acts as a link between your application and the Tomcat engine. You create a ServletContext by adding a line in the conf/server.xml file. It looks like this:
<Context path="/foo" docBase="foo" debug="0"
The path attribute tells Tomcat that all request URLs ending in /foo belong to the foo application. The docBase attribute tells Tomcat that the foo application resides in a subdirectory of the webapps folder called foo.
You can now copy all the JSP, HTML, and image files associated with your application. You place JSP and HTML files in the application directory. Next, create a web.xml file in the WEB-INF folder (you can copy and modify one of the existing web.xml files to get started). Copy your Servlets to the /foo/WEB-INF/classes directory and add an entry to the web.xml file for each Servlet associated with the application. The Servlet entry provides Tomcat with information about the Servlet, its class file, and any parameters that may need to be passed to the Servlet. If your application consists only of JSP pages, then you don't need to worry about modifying the web.xml file.