如何去除idea中thymeleaf模板中飘红问题

目录

Thymeleaf语法(最常用)

如何去除idea中thymeleaf模板中飘红问题


Thymeleaf语法(最常用)

  1. 获取变量值${...}

<!--不转义-->
<div th:text="${msg}"></div>
<!--转义-->
<div th:utext="${msg}"></div>
  1. 链接表达式: @{…} ,类似的标签有:th:hrefth:src

<a href="details.html" th:href="@{/order/details(orderId=${o.id})}">view</a>
  1. 循环

model.addAttribute("users", Arrays.asList("aaa","bbb"));
<h2 th:each="user:${users}" th:text="${user}"></h2>
<!--<h2 th:each="user:${users}">[[${user}]]</h2>-->

如何去除idea中thymeleaf模板中飘红问题

打开设置

 选择editor,然后打开Inspections

 搜索thymeleaf然后将Expression variables validation选项后面的勾选框去掉,最后点击应用

 飘红已经消失

猜你喜欢

转载自blog.csdn.net/qq_44765534/article/details/125907151
今日推荐