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
When encapsulating the date picker, you need to d...
1. MySQL download address; http://ftp.ntu.edu.tw/...
1. Basic syntax structure of HTML submit and bott...
Table of contents 1. Preprocessing 2. Compilation...
Table of contents 1. Introduction 1.1 Babel Trans...
Table of contents Vite project build optimization...
Table of contents 1. The difference between funct...
Table of contents Component recursive call Using ...
1. Explanation of provide and inject Provide and ...
Table of contents Integrity constraints Definitio...
This article shares the specific code of vue echa...
Why did I use this? It all started with the makin...
This article example shares the specific code for...
In fact, we have been hearing a lot about web des...
Table of contents animate() animation method Anim...