Spring boot使用Thymeleaf模板的时候标签未关闭报错解决
2018-01-17 17:32
429 查看
问题
在spring boot 中,推荐使用thymeleaf来做前端模版引擎,但是会报标签未关闭:org.thymeleaf.exceptions.TemplateInputException: Exception parsing document: template="login"
比如:
<link rel="stylesheet" type="text/css" href="../css/bootstrap.css" >必须改成
<link rel="stylesheet" type="text/css" href="../css/bootstrap.css" />;
如果一个一个改的话又很麻烦。。。ヽ(#`Д´)ノ
解决
1.在pom.xml中引入依赖:
<dependencies> <!--thymeleaf--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>net.sourceforge.nekohtml</groupId> <artifactId>nekohtml</artifactId> <version>1.9.22</version> </dependency> </dependencies>
2.在
application-dev.yml中设置:
spring: thymeleaf: cache: false mode: LEGACYHTML5 server: port: 8081
相关文章推荐
- springboot 1.5.2 thymeleaf 标签未关闭异常解决办法
- Spring Boot使用thymeleaf模板
- (8)spring boot使用thymeleaf模板引擎
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- (18)使用模板(thymeleaf-freemarker)【从零开始学Spring Boot】
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- Spring-boot中thymeleaf模板使用小结
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- 深入学习spring-boot系列(三)--使用thymeleaf模板
- spring-boot--使用thymeleaf模板