IntelliJ 中用于 Spring 的 Thymleaf - URI 未注册

问题描述 投票:0回答:4

我的 home.html 文件显示 URI 未在 IntelliJ 中注册(设置|语言和框架|架构和 DTD)错误。

包含命名空间的 html 文件是

<!DOCTYPE html><html lang="en" xmlns:th="http://www.thymeleaf.org"> 

我尝试获取外部资源,但这不起作用

spring intellij-idea thymeleaf
4个回答
17
投票

运行代码时,该错误不是问题,但 IntelliJ 无法为您提供

th:*
函数的代码补全。

这是 JetBrains 有意为之,因为他们在此指定: https://www.jetbrains.com/help/idea/thymeleaf.html

为了能够在 IntelliJ IDEA 中使用 Thymeleaf 支持,请确保启用 Thymeleaf 插件。 (该插件与 IDE 捆绑在一起并默认启用。)

页面顶部写着:

此功能仅在旗舰版中支持。

我还没有找到可以为您提供 Thymeleaf 支持的社区版插件,但 Thymeleaf 可以完美工作,只是您不会从 IDE 获得任何帮助


2
投票

前往: 文件|设置|插件

单击“安装 Jetbrains 插件...”。在搜索栏中找到Thymeleaf,点击安装。

需要重新启动。


2
投票

添加

www
后我解决了问题。

本来我是这样添加的 ->

http://thymeleaf.org


0
投票

参考https://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html

换线

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

<html lang="en" xmlns:th="http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">

之后点击这条线,你会发现一个灯泡

点击它,你会发现

获取外部资源

选项

单击该按钮即可解决该错误。

© www.soinside.com 2019 - 2024. All rights reserved.