我正在使用终极版,以下代码工作正常。如下所示,问题是错误的亮点。一直在检查,看起来我不需要额外的插件。有没有解决的办法?
我在html文件页面的顶部使用了以下行。
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<div class="gifs container">
<div class="row">
<div th:each="gif : ${gifs}" class="col s12 l4">
<a th:href="@{'/gif/' + ${gif.name}}">
<img th:src="@{'/gifs/' + ${gif.name} + '.gif'}" />
<a href="#" th:class="(${gif.favourite}? 'un':'') + 'mark favorite'"></a>
</a>
</div>
</div>
</div>
答案 0 :(得分:0)
据我所知,Thymeleaf插件无法推断出gifs和gif变量的类型,因为添加模型参数的控制器与模板本身之间没有连接。 IntelliJ中的Thymeleaf集成工作正常,由th表示:标签没有加下划线:p
答案 1 :(得分:0)
我发现,当您在变量对象中添加注释时,它会起作用。
例如:
<!--/*@thymesVar id="trackingNumberList" type="java.util.ArrayList"*/-->
<!--/*@thymesVar id="gif" type="com.myproject.mygifs"*/-->
是否可以使用特定类型的Arraylist是另一个问题。