Springboot+thymeleaf+IDEA----解决 thymeleaf 中th 爆红

问题

在IDEA编程中,遇到 th 标签爆红出错
在这里插入图片描述

解决方法

  1. 短时
    修改
    <html lang="en">

    <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

  2. 长时
    File --> Settings --> Editor --> File and Code Templates
    在这里插入图片描述
    修改模板为

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
</body>
</html>

然后点击 Apply 和 OK 选项
在这里插入图片描述
此时的 th 标签已经可以正常使用
在这里插入图片描述


版权声明:本文为weixin_47957229原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。