First, deployment mode
1, three kinds of simple deployment methods:
(1), i.e. directly deploy the project from IDE integrated development environment (Eclipse MyEclipse) to Tomcat specific steps see Web projects in eclipse automatically deployed to Tomcat
(2), the deployment of the war package is to make your project into a war package directly copied to the Tomcat default loading directory, generally do not modify the words are under the WebApps, that is, conf/servlet/host appbase refers to this directory.
(3), copy the project to ComCat's default load directory WebApps, this is the same as IDE integrated deployment.
2. Two kinds of flexible deployment methods:
(1), configure conf/servlet/, add a Context to the servlet file's host: <context docbase= "test" path= "/test" reloadable= "true" source= " Org.eclipse.jst.jee.server:test "/>
Docbase refers to the physical strength of your project, and path refers to the path that the browser accesses, such as: Http://localhost:18080/test test is the value of this path. Note here that docbase this path, you have to refer to the classes file to store your compiled code in the upper level of the directory, if only to you this project must be this directory format: test/web-inf/classes, because Tomcat The container wants your compiled executable code.
Configuration instance:
<context docbase= "D:\Javaee\project\testresin\webapp" path= "/testresin" reloadable= "true" source= " Org.eclipse.jst.jee.server:test "/>
DocBase looked different from the previous one, because the classes file was stored under WebApp when the project was created with Eclipse, so docBase is no longer a simple project name but refers to the web-inf/classes directory, path is the access path to the project: http://localhost:18080/testresin/
(2), this configuration mode is the most flexible, it is recommended to deploy such a \conf\catalina\localhost path under the new file . Xml:
You can create an. xml file in the localhost directory and configure it with the same configuration as the servlet, docBase refers to the physical path of your project.
<context docbase= "test" path= "/test" reloadable = "false"/>
In this setting, the value of path is not the name of the project and the project name is OK, can be arbitrarily set, but note that the name of the. xml file cannot be duplicated, the name of the file is the address that the browser accesses
Configuration instance: this instance and 2 (1) are two configurations of the same project, and you'll see their differences:
Created . XML file:
Configuration . XML file: <context docbase= "D:\Javaee\project\testresin\webapp" path= "" reloadable= "true" source= " Org.eclipse.jst.jee.server:test "/>
Browser Access Path
Summary: From This example we can see that the same project Testresin created under servlet and localhost. The two configurations of XML, DocBase are the same, point to the physical path of the project, and note that the classes is located in the parent Web-inf this directory, and in the servlet path is the browser access to create under localhost. The path value of this configuration of XML can be arbitrarily valued, not related to the project name and the browser access address, and the file name is the path that the browser accesses.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How to deploy project on Tomcat summary