An error happened during template parsing (template: “class path resource [templates eachList.html]”)
做springBoot使用thymeleaf模板的时候出现这个错误,检查java代码和配置文件都没有错,
<html lang="en" xmlns:th="http://www.thymeleaf.org">
这个网址也没有错,后来发现是我的html里面的代码写错了:
<table border="1" cellpadding="6" cellspacing="1" th:width="100%" >
其中 th:width=“100%“应该写成th:width=”‘100%’”,双引号里面再加个单引号
要么前面就不加th:,不过这样就不是使用模板了,使用模板可以动态的获取里面的值,看情况需要 。
使用thymeleaf模板应该像下面这样写。
<table th:border="'1'" th:cellpadding="'6'" th:cellspacing="'1'" th:width="'100%'" >
idea有时候你只是敲了不带th:的,但是它提示的第一个里面是带th:,我就是没看清就按回车了然后就打成 th:width=“100%”