1.html页面遍历值时候出现红线

如图:

        Idea SpringBoot之Thymeleaf遍历值采坑

解决:File==》 settings==》Editor==》Inspections

     如图:

          Idea SpringBoot之Thymeleaf遍历值采坑

        将途中所示的√去掉。

2.运行获取页面信息报错 

freemarker.core.NonStringOrTemplateOutputException: For "${...}" content: Expected a string or something automatically convertible to string (number, date or boolean), or "template output" , but this has evaluated to a sequence (wrapper: f.t.SimpleSequence):
==> usernames  [in template "user/list.html" at line 23, column 25]

----
FTL stack trace ("~" means nesting-related):
    - Failed at: ${usernames}  [in template "user/list.html" at line 23, column 23]
----

.........

上网查找说未获取到值,在application.properties添加spring.freemarker.settings.classic_compatible=true

但仍然报错,最后自己找到application.properties里的spring.freemarker.suffix配置信息应该为.ftl,而不是html。

 

相关文章: