码迷,mamicode.com
首页 > 其他好文 > 详细

IDEA中thymeleaf 表达式报红波浪线

时间:2019-08-31 12:44:06      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:取值   div   ilo   项目   ==   lstat   blog   bsp   name   

一,场景再现

最近在做一个SpringBoot项目,于是自然就接触到了thymeleaf .但是在开发中,遇到一个很奇怪的现象.

 

 技术图片

从上面图片我们看到,我们在html页面利用thymeleaf表达式取值,底部有红色波浪线,但是启动项目,却能正常显示,这是为什么?

二.刨根问底
我们虽然在后端的model数据中添加了,但是对于前端文件是无法感知的。因为这个时候并没有程序运行,也没有如此的智能。所以这个时候就会有红色波浪线存在了

三.解决方案

①.根据IDEA提示,有如下申明

		<!--/*@thymesVar id="channels" type=""*/-->
                 <tr th:each="channel,channelStat:${channels}">
                 <td th:text="${channel.channel}"></td>
                  <td th:text="${channel.channelName}"></td>
                  <td th:text="${channel.defaultWorkNumber}"></td>
                  <td th:text="${channel.defaultBureaotoCode}"></td>
                  <td th:text="${channel.createTime}"></td>
                  <td th:text="${channel.phoneNoType} == 0 ? ‘专属‘ : ‘共享‘"></td>

  

②.在<!DOCTYPE html>下加上

<!--suppress ALL-->

  

③.修改IDEA设置
把设置里面的 Editor->Inspections->Thymeleaf->Expression variables validation后面的勾去掉


————————————————
原文链接:https://blog.csdn.net/Milogenius/article/details/84668291

 

IDEA中thymeleaf 表达式报红波浪线

标签:取值   div   ilo   项目   ==   lstat   blog   bsp   name   

原文地址:https://www.cnblogs.com/myxx-n/p/11438482.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!