Implementation of tomcat deployment project and integration with IDEA

Implementation of tomcat deployment project and integration with IDEA

3 ways to deploy projects with tomcat

  • Put the project directly into the webapps directory
  • Configure the conf/server.xml file
  • Create an xml file with any name in conf\catalina\localhost.

Put the project directly into the webapps directory

Create 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 IDEA

Integrated Configuration

idea

We are local now. Select the installation directory of Tomcat

In this way, Tomcat is integrated into idea

Creating a web project

Startup 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 deployment

We 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 deploy a Web project in Tomcat (must read)
  • Detailed explanation of the basic steps to deploy the Web project War package to the Tomcat server
  • Tomcat 7 deploys two projects by setting different ports
  • Detailed explanation of CentOS installation of tomcat and deployment of Java Web projects
  • Detailed steps for importing eclipse projects into IDEA and deploying them to tomcat
  • How to deploy JavaWeb project to Tomcat server in IDEA
  • Idea configures maven-tomcat-plugin to implement project deployment
  • Solve the problem that web project web page changes under tomcat deployment cannot be automatically refreshed
  • Detailed graphic explanation of the process of deploying the created Java web project to Tomcat in idea

<<:  How to handle token expiration in WeChat Mini Programs

>>:  Example code for implementing a QR code scanning box with CSS

Recommend

Implementation of Nginx configuration https

Table of contents 1: Prepare https certificate 2:...

Vue Element front-end application development: Use of API Store View in Vuex

Table of contents Overview 1. Separation of front...

Steps to modify the MySQL database data file path under Linux

After installing the MySQL database using the rpm...

Linux firewall iptables detailed introduction, configuration method and case

1.1 Introduction to iptables firewall Netfilter/I...

Tutorial on Installing Nginx-RTMP Streaming Server on Ubuntu 14

1. RTMP RTMP streaming protocol is a real-time au...

Overview of the definition of HTC components after IE5.0

Before the release of Microsoft IE 5.0, the bigges...

DIV common attributes collection

1. Property List Copy code The code is as follows:...

HTML fixed title column, title header table specific implementation code

Copy code The code is as follows: <!DOCTYPE ht...

MySQL 8.0.25 installation and configuration method graphic tutorial

The latest download and installation tutorial of ...

Vue.js application performance optimization analysis + solution

Table of contents 1. Introduction 2. Why do we ne...

How to convert Chinese into UTF-8 in HTML

In HTML, the Chinese phrase “學好好學” can be express...

5 MySQL GUI tools recommended to help you with database management

There are many database management tools for MySQ...

Vue+Router+Element to implement a simple navigation bar

This project shares the specific code of Vue+Rout...