The most important thing for idea to package a web project into a war is to configure atrificats. First open file -> project structure After creation, the output directory is the path of the output war package. The name can be anything you want, then click the green + to open the directory content Select the webapp directory and remember to check include in project build After clicking OK, create a new configuration Select artificats In this way, even if the configuration is completed, after clicking run to execute, just find the war package in the folder set in the previous output directory. Put the war package in the webapp directory of tomcat, and then start tomcat to access the project. The access address of the project is localhost:8080/your war package name/index What I want to say here is that since the name of the war package determines the access address, when using pure html+css+js to write a page, it is best to add your project name (that is, your final war package name) to the resource reference address of the page, for example, referencing a js file:
At this time, if you hold down the ctrl key and hover the mouse over the file path, there will be a clickable prompt. However, when the project is deployed on tomcat, the war package is equivalent to adding a folder named your war package. At this time, the original reference will prompt that the file cannot be found. At this time, we should reference it like this:
When your reference address contains .., for example:
It should be modified like this:
But here comes the problem. When configured in this way, the file can be found when deployed to tomcat, but after starting tomcat debugging in local idea development, the file cannot be found. At this time, you should configure the application context and start it. And make sure it is consistent with the file path when deployed to Tomcat, so there is no need to modify the address of the front-end page when deploying to Tomcat. (jsp does not need to consider this problem because jsp can obtain the root path). If the application context is just "/", then it is equivalent to placing all files under tomcat's webapp and accessing them directly through localhost:8080/file. This is the end of this article about packaging idea into a war package and deploying it to Tomcat and the access path problem (detailed explanation with pictures and text). For more relevant idea war package deployment to Tomcat content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: js method to realize shopping cart calculation
>>: Summary of SQL query optimization knowledge points for MySQL tens of millions of big data
I used to think that script could be placed anywh...
1. Install mysql Run the following command to upd...
1. Install JDK 1.1 Check whether the current virt...
Table of contents 1. Introduction to Harbor 1. Ha...
Overview of MySQL Partitioned Tables We often enc...
Specific method: First open the command prompt; T...
Table of contents Usage scenarios How to achieve ...
First, let's simulate the data coming from th...
MySQL replication table detailed explanation If w...
Table of contents What is index pushdown? The pri...
mysql-5.7.9 finally provides shutdown syntax: Pre...
Introduction: MySQL database recovery by time poi...
1. CSS3 triangle continues to zoom in special eff...
Table of contents Why understand the life cycle W...
Table of contents 1. Effect 2. Main code 1. Effec...