[ Team LiB ] Previous Section Next Section

Installing a WAR File Under Tomcat

Prior to Tomcat version 4, the only way to install a WAR file in Tomcat was to copy it to the webapps directory underneath the main Tomcat directory. Changing an application required you to restart the server. Version 4 introduced the Tomcat Manager, which lets you deploy and undeploy applications without restarting. This is the recommended way to deploy applications.

Tomcat automatically assigns a base path for the application, based on the name of the WAR file. Because the example here is named example.war, Tomcat assigns the application a prefix of /example. This means that the URI to access the application is something like:

http://localhost:8080/example/ExampleWarServlet

Figure B.1 shows the results of the application running under Tomcat.

Figure B.1. Tomcat automatically assigns the application name based on the WAR filename.

graphics/ap02fig01.gif

    [ Team LiB ] Previous Section Next Section