Tomcat virtual paths and tomcat virtual paths
Generally, we directly reference web projects under webapps. If we want to deploy a WEB project elsewhere, we need to set the virtual path in TOMCAT, tomcat loads the xml file under $ atat_home $ \ conf \ Catalina \ localhost first (the path of the web project is configured in the file ), then load the web Project under webapps.
Suppose we want to deploy the XXX project under d: \ project \ (XXX is the project name ).
In this case, we have two methods:
Method 1: Create an XML file under the $ Tomcat_home $ \ conf \ Catalina \ localhost path. Note: The XML file name is the web root path after the project is successfully deployed. assume that the test. xml, the following access path is http: // ip: port/test. The file content is as follows:
1 <?xml version="1.0" encoding="UTF-8"?>2 <Context docBase="D:\project\XXX" reloadable="true" debug="0" path="/test"/>
In fact, path = "/test" is not written here. The path is actually determined by the name of the xml file, so it can be abbreviated
1 <Context docBase="D:\project\XXX" reloadable="true" debug="0" />
In this way, the virtual path of/test is set.
Method 2: edit the server File (% tomcathome % \ conf \ server. xml)
We plan to create a virtual directory of myjsp. You only need to add the following code to the file in the % atathome % \ conf \ server. xml file and add the following code to the
1 <Context docBase="D:\project\XXX" reloadable="true" debug="0" path="/test"/>
Note: At this time, the path must be written, because we have not created a new xml file, so you must specify the web.
Description of configuration file attributes:
When debugging java code of a web project, debug integrates the tomcat server with the development tool or requires a tool
Some plug-ins are supported (such as myclipse in Eclipse). These methods are implemented locally, that is, your development tool and
Tomcat runs on the same server. If your development tools and servers are no longer running on one server, you need to implement remote
Debug the function.
In fact, the log4j package is introduced in general java project development, and debugging information is output during the development process through configuration. If
It is not a special requirement. It is not recommended to spend time studying it.
When the reloadable attribute is set,
When reloadable = true, the related file changes. Tomcat stops the web app and releases the memory, and then reloads the web app.
. In this way, you can save the time to manually deploy the web app project. It can be used with development tools to slightly improve work efficiency.
Rate.