Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between deploying war and war exploded in Tomcat

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What is the difference between deploying war and war exploded in Tomcat? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

The difference between war and war exploded

When using an IDEA development project, the following usually occurs when deploying Tomcat:

Whether to choose war or war exploded first take a look at the difference between the two:

War mode: upload the WEB project to the server as a package

War exploded mode: upload the WEB project to the server with the location of the current folder

(1) war mode can be called release mode. As you can see from the name, this is typed into a war package before releasing.

(2) the war exploded mode is to directly move folders, jsp pages, classes, etc., to the Tomcat deployment folder for loading and deployment. Therefore, this approach supports hot deployment, and is generally used in development.

(3) in peacetime development, if you use hot deployment, you should set the Tomcat accordingly, so that the modified jsp interface and other things can be displayed in time.

Change the location where the arrow points so that hot deployment can be achieved.

Pitfalls encountered when developing with war mode

1. The location of the project code is as follows:

The above projects are SSM projects.

2. The location of the Tomcat used for deployment:

The code used to obtain the absolute path of the context:

String contextPath = request.getSession () .getServletContext () .getRealPath ("/")

4. The experimental process and results of the two methods:

(1) when developing in war mode, use the following code to obtain the relative path of the project:

String contextPath = request.getSession () .getServletContext () .getRealPath ("/")

The path obtained by war mode is always as follows:

Where C:\ Software\ apache-tomcat-8.0.32 is the location of my Tomcat.

You can see that the war pattern is the location where the final package is deployed to Tomcat.

(2) then look at the war exploded mode, set it similarly, and run the same code. The running result is as follows:

After reading the above, have you mastered the method of deploying war and war exploded in Tomcat? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report