3 ways to deploy projects with tomcat
Put the project directly into the webapps directoryCreate a new haha folder, this folder is equivalent to a project Create an a.xml file in the folder The content of the xml file is Copy the project to the webapps directory and restart tomcat Visit Page If garbled characters appear, you can refer to this solution to the Chinese garbled characters in Tomcat static pages (html) /haha: Access path of the project --> virtual path /a.html: resource path Simplified method Remove the haha project first Our tomcat is still running and has not been shut down. Add one more file b.html to the project Package a.html and b.html Change the compressed file suffix to war package format Put the war package into the webapps directory and find that the file is not automatically decompressed. Check the log From the log file, we can know that the required format is zip, rar format is not acceptable. So we use 7Zip to compress it into zip format, and then change the format to war format Then put c.war into the webapps directory and find that it is automatically decompressed Because our tomcat is not closed, visit Why? Because our virtual directory has changed, our war package is c.war, and the virtual directory after decompression is c, so revisit Accessing b-files When tomcat is running, if you delete the war package, the corresponding decompression folder will be automatically deleted, and the project will be deleted. Disadvantage: Need to copy the project Configure the conf/server.xml file (not recommended)Now there is no customized project in my webapps directory Create a heihei project in the folder of drive E. There is only a.html file in it, and the content of the file is in red words: Heihei Xia Find the configuration file server.xml Find the Host tag Add the following configuration: <Context docBase="E:\heihei" path="/lala" /> Note: docBase: the path of the project path: virtual path Start tomcat access shortcoming: Because the configuration is written in the server.xml file, the configuration in this file is the core configuration of Tomcat. If you configure and deploy it here, it may damage the configuration of Tomcat, and it will have to be restarted every time it is modified, so this method is not recommended. Create an xml file with any name in conf\catalina\localhost. (Most recommended) (Hot deployment)Create a hehe project in the folder of drive E. There is only a.html file in it, and the content of the file is in red words: hehexia conf\catalina\localhost Create an XML file with any name Add the following configuration to the xml file: <Context docBase="E:\hehe" /> Note: docBase: the path of the project The virtual path accessed is the file name of this xml Our tomcat is always started, no need to restart, directly access This is hot deployment. In the future, when you add new projects, you can just add the XML file without restarting Tomcal. If you don't need this project anymore, you don't need to delete it. Just change the file name suffix (you can choose any suffix) After changing it, the project can no longer be accessed. Integration of tomcat and IDEAIntegrated Configurationidea We are local now. Select the installation directory of Tomcat In this way, Tomcat is integrated into idea Creating a web projectStartup Success Look at the log and see the path where our project is deployed to tomcat access The default setting is in the tomcat configuration file web.xml We add another aa.html page to the new project access You need to restart the project and access it again Hot deploymentWe added an aa.html page above. We need to restart the project. Is it troublesome? Let's configure hot deployment. Add another page bb.html Direct access, no need to restart the project This is the end of this article about tomcat deployment projects and the implementation of integration with IDEA. For more relevant tomcat deployment project content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to handle token expiration in WeChat Mini Programs
>>: Example code for implementing a QR code scanning box with CSS
Table of contents 1: Prepare https certificate 2:...
Table of contents Overview 1. Separation of front...
After installing the MySQL database using the rpm...
1.1 Introduction to iptables firewall Netfilter/I...
Overview As for the current default network of Do...
1. RTMP RTMP streaming protocol is a real-time au...
Before the release of Microsoft IE 5.0, the bigges...
1. Property List Copy code The code is as follows:...
Say it in advance Nodejs reads the database as an...
Copy code The code is as follows: <!DOCTYPE ht...
The latest download and installation tutorial of ...
Table of contents 1. Introduction 2. Why do we ne...
In HTML, the Chinese phrase “學好好學” can be express...
There are many database management tools for MySQ...
This project shares the specific code of Vue+Rout...