About virtual paths. In learning Javaweb's training courses, today the teacher gave a scene like this. When we have a project in a different directory, how do we use Tomcat to manage the Web project. The solution proposed by the teacher is to take advantage of the virtual path and configure Tomcat as follows. Enables Tomcat to manage items on different directories.
My question: is the project not converted into a war package posted to Tomcat, and then placed under the WebApps directory? Or put the item directly under WebApps. 1. Why is it possible to manage Web projects under different directories? 2. The above two ways of handling the publication of a Web project can be accessed by the Web site of the Tomcat server. So what's the difference between the two ways? Then I finally understand that Tomcat is, after all, a server Web project management software, then there is a possibility that one of the server's drive letter capacity is not enough. So the virtual path to manage the web under the different drive letter to the purpose of having its meaning. Paste on Configuration: Virtual path: Add a Web from another location to Tomcat for management
* Browser access: http://localhost:8080/web3/1.html
* Way 1: Need to configure Tomcat
* Location:%tomcat%/conf/server.xml
* Structure (content)
<server port= "8005" shutdown= "Shutdown" > #表示服务配置, equivalent to the hotel
<service name= "Catalina" > #具体服务, such as: dinner
<connector port= "8080" protocol= "http/1.1"/> #连接, such as: Server Staff
<connector port= "8009" protocol= "ajp/1.3"/>
<engine name= "Catalina" defaulthost= "localhost" > #引擎: Rear Chef
# # # Host must have a unique name
</Host>
</Host>
</Engine>
</Service>
</Server>
* Configuration Content
The following code is configured inside the <Host> tag:
<context path= "web3" docbase= "F:/web"/>
# # # # #所以此处类似于添加了一种映射关系, so that Tomcat server can access the project under the actual location of Docbase through the path value
After rebooting tomcat, you can see in the manager of the Tomcat service page that the project has been deployedSince the above has been shown, then directly in the URL to knock the address is OK* Mode 2:
* Add a configuration file (XML file), Location:%tomcat%/conf/engine name/host name/
* Context path is the file name of the XML file, for example: Web4.xml
* Content: <context docbase= "F:/web"/>
* Access: http://localhost:8080/web4/1.html
* Tomcat Default value:
<engine name= "Catalina" > Engine name
</Host>