【发布时间】:2021-08-16 23:16:44
【问题描述】:
我使用 spring-boot 2.5.0 和 maven 作为依赖管理工具。到目前为止,我的项目中有以下依赖项。
"<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>"
我想使用 jsp 代替 thymeleaf,但是当我将“index.html”文件放入 templates 或 resources 的子文件夹时em> 文件夹它无法识别 html 文件并引发白色标签错误。当我添加 thymeleaf 依赖项时,它可以完美运行并识别 html 文件。 那么,我应该怎么做才能让spring-boot在不添加thymeleaf依赖的情况下检测我的html文件。顺便说一句,我以前从未使用过jsp。
【问题讨论】:
-
我不确定你在用 html 文件和 JSP 做什么——你必须提供你想要实现的具体细节。
-
看到这个link 可能有用
-
@BoristheSpider 我正在练习,只是在浏览器中创建一个视图。在练习时,我使用的是一个简单的 html 文件,它只是说你好。我计划稍后使用 jsp 文件对其进行更改,但这不是问题。问题是我的文件没有被检测到。它是 jsp 还是 html 文件是否重要?我只是要求检测我的视图。
-
只是一个旁注:如果你刚开始,你肯定应该选择百里香。比jsp干净多了。
-
谢谢@gowridev,非常有帮助
标签: java spring spring-boot thymeleaf