Tomcat project deployment method: tomcat project deployment
Method 1:
In the Conf directory of Tomcat, add the following to the <Host/> node in Server. Xml:
<Context Path="/Hello"Docbase="D:\Users\WebProject\WebContent" Debug="0" Privileged="True" Reloadable="True"></Context>
The Reloadable = "true" attribute indicates that files are automatically loaded when there is a change, that is, hot loading. In large web projects, we recommend that you do not use hot loading, which will greatly degrade system performance.
Method 2: copy the Web project file "You can also copy the generated war" to the Webapps directory.
Method 3: flexible. In the Conf directory, create a new Catalina (case sensitive)/Localhost directory and create an Xml file in the directory. The name can be retrieved at will, the content of the Xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?><Context docBase="D:\Users\WebProject\WebContent"> <WatchedResource>WEB-INF/web.xml</WatchedResource></Context>
The third method is to generate the preceding XML file in the conf \ catalina \ localhost directory of Tomcat after the Web application is loaded. You can manually create the xml file, point to the web project of your workspace.
<Context path="/admin" docBase="${catalina.home}/server/webapps/admin" debug="0" privileged="true"></Context>
The 3rd methods have the advantage of defining aliases. The project running on the server is named web1, and the file name of web2 is used for external access URLs. This method can easily hide the project name. Some Project names are fixed and cannot be changed. However, it is very effective to change the path for external access.
By the way, the mainstream Java IDE, Eclipse, and IDEA all support built-in Tom, which is very convenient for starting and debugging web projects.
In my opinion, the built-in startup Tom is faster than the built-in Tom in IDE. Applications started in external Tomcat in the LAN can be accessed by others, and the built-in Tom cannot.