[英]Spring boot doesn't identify html templates without Thymeleaf dependency
I am using spring-boot 2.5.0 and maven as dependency management tool.我使用 spring-boot 2.5.0 和 maven 作为依赖管理工具。 I have following dependencies as of now in my project.
到目前为止,我的项目中有以下依赖项。
"<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>"
I want to use jsp instead of thymeleaf but when I put my "index.html" file inside templates or static sub-folder of resources folder it doesn't recognize the html file and throws white label error.When I added the thymeleaf dependency it worked perfectly and recognized the html file. I want to use jsp instead of thymeleaf but when I put my "index.html" file inside templates or static sub-folder of resources folder it doesn't recognize the html file and throws white label error.When I added the thymeleaf dependency it工作完美并识别 html 文件。 So, what should I do to make spring-boot detect my html file without adding thymeleaf dependency.
那么,我应该怎么做才能让 spring-boot 检测到我的 html 文件而不添加 thymeleaf 依赖项。 By the way I have never used jsp before.
顺便说一句,我以前从未使用过 jsp。
It seems you are missing either of the two things.看来您缺少这两件事中的任何一件。
you should put below the property with the desired value in the property/yaml file您应该在属性/yaml 文件中将所需值放在属性下方
spring.mvc.view.prefix: <location of html/jsp> spring.mvc.view.prefix: <html/jsp的位置>
spring.mvc.view.suffix: <.extension> spring.mvc.view.suffix:<.extension>
check at your controller whether you are sending the correct view name or not.检查您的 controller 是否发送正确的视图名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.