I. Static deployment
All statically deployed Web applications must restart the server to take effect.
1. Copy the web application directory to $ catalina_home/webapps, and restart the Tomcat service.
For example, if you copy the AAA directory to $ catalina_home/webapps, you can access the Web application through http: // localhost: 8080/AAA.
2. Modify the server. xml file
For example, add a line (case sensitive)
<Context docBase = "D:/VirtualHost1" reloadable = "false" path = "/ggg"/>
You can access the Web Application D:/virtualhost1 through http: // localhost: 8080/ggg.
3. In$CATALINA_HOME
Add an XML file under/CONF/Catalina/localhost
For example$CATALINA_HOME
/CONF/Catalina/localhost creates a test. xml file with a context element, as shown in figure
<Context docBase = "D:/VirtualHost1" reloadable = "false"/>
You can use http: // localhost: 8080/test to access the Web application in D:/virtualhost1. Note that the context element does not have the path attribute. In this way, the server uses the. xml name as the value of the path attribute.
4. Use war files
Replace the folder in the preceding example with a war file.
To create a war file, first enter the directory of the Web application, such as D:/virtualhost1, and then execute jar cf kkk. War *.*
Ii. dynamic deployment
Open http: // localhost: 8080, there is a Tomcat Manager link on the left, click in, enter the user name and password (which can also be set in $ CATALINA_HOME/conf/tomcat-users.xml during installation) and dynamically deploy the web application at the bottom of the page that opens. You do not need to restart the server after deployment.
Reference http://www.diybl.com/course/3_program/java/javashl/200815/95846_2.html