java WEB-INF 文件夹未在 Spring Boot 应用程序中创建?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48277952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WEB-INF folder is not creating in Spring Boot application?
提问by Rajanikanta Pradhan
I am creating a Spring Boot application, using Spring Initializr, But the folder structure is bit different, there is no WEB-INF
folder, so where I will put the JSP files, shall I create the WEB-INF
folder manually?
我正在创建一个 Spring Boot 应用程序,使用 Spring Initializr,但是文件夹结构有点不同,没有WEB-INF
文件夹,那么我将把 JSP 文件放在哪里,我应该WEB-INF
手动创建文件夹吗?
采纳答案by sapan prajapati
We need to crate WEB-INF folder manually in spring boot application. Follow below steps to create WEB-INF folder
我们需要在 spring boot 应用程序中手动创建 WEB-INF 文件夹。按照以下步骤创建 WEB-INF 文件夹
Select main folder as highlighted below.
- Right click and create a folder with name webapp.
- Now right click on webappfolder and create WEB-INFfolder.
- Now similarly create a viewfolder (or any other name you like) inside WEB-INF folder to keep all the JSPs.
Below should be the folder structure after doing above steps.
回答by craigwor
Usually the web files will go into the resources folder with spring boot. https://spring.io/guides/gs/serving-web-content/
通常 web 文件会通过 spring boot 进入资源文件夹。 https://spring.io/guides/gs/serving-web-content/
回答by arc
Dumping the jsp files in src/main/webapp
folder worked for me, both with or without WEB-INF. I followed the exact project structure mentioned in
转储文件src/main/webapp
夹中的 jsp 文件对我有用,无论有没有 WEB-INF。我遵循了中提到的确切项目结构
回答by user3997694
I had the same problem. To solve this, You need to change in your pom.xmlfrom jarto war, and do the following...
我有同样的问题。要解决此问题,您需要将pom.xml从jar更改为war,然后执行以下操作...
cd "my_project"
mvn clean package
java -jar my_project.war
And everything workout.
和一切锻炼。