【发布时间】:2017-12-10 07:31:39
【问题描述】:
我给你写信是因为我不知道我必须将我的 JSP 文件放在 SpringBoot 应用程序中的什么位置..
A screen of my application's files
提前感谢您的回复, 诺曼。
PS:对不起,我不能在帖子开头打招呼,它总是被删除..
【问题讨论】:
-
谢谢你,我要读这篇文章:)
标签: spring file spring-boot
我给你写信是因为我不知道我必须将我的 JSP 文件放在 SpringBoot 应用程序中的什么位置..
A screen of my application's files
提前感谢您的回复, 诺曼。
PS:对不起,我不能在帖子开头打招呼,它总是被删除..
【问题讨论】:
标签: spring file spring-boot
您应该将文件放到src/main/resources/static(或src/main/resources/public 或src/main/resources/resources)。所有这些都是由 Spring Boot 自动配置注册的。
您还应该将以下属性添加到application.properties
spring.mvc.view.suffix=.jsp
【讨论】:
在春季添加jsp文件的关键 为此,以下步骤很重要: - 在 src/main 中创建名为 webapp 的文件夹 - 在其中创建名为 WEB-INF 的文件夹 - 将此行添加到您的 pom 文件中
<!-- Spring MVC framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<!-- for compile only, your container should have this -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servletapi.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
您可以访问网址以获取有关步骤press here的更多详细信息
【讨论】: