spring-mvc - thymeleaf 代码完成无法正常工作 intellij 14

标签 spring-mvc intellij-idea thymeleaf intellij-14

我正在尝试将 thymeleaf 模板引擎与带有 Intellij 14 的 Spring MVC 一起使用,但代码完成不起作用。请帮帮我。

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <title>Spring Core Online Tutorial</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

  <link href="http://cdn.jsdelivr.net/webjars/bootstrap/3.3.4/css/bootstrap.min.css"
        th:href="@{/webjars/bootstrap/3.3.5/css/bootstrap.min.css}"
        rel="stylesheet" media="screen"/>

  <script src="http://cdn.jsdelivr.net/webjars/jquery/2.1.4/jquery.min.js"
          th:src="@{/webjars/jquery/2.1.4/jquery.min.js}"></script>

  <link href="../static/css/spring-core.css"
        th:href="@{css/spring-core.css}" rel="stylesheet" media="screen"/>
</head>

<body>
<div class="container">
  <h1>Hello World</h1>
  <h2>This is my Thymeleaf index page. This is my changed.</h2>
</div>
</body>
</html>

最佳答案

intellj idea 14 完全支持 thymleaf。这里缺少的部分是命名空间的使用

<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">

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

在您的模板中使用它,您将获得 intellij 完成。希望这能回答你的问题。谢谢

关于spring-mvc - thymeleaf 代码完成无法正常工作 intellij 14,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38034133/

相关文章:

java - NoClassDefFoundError : org/aopalliance/intercept/MethodInterceptor

java - 运行 java -jar 时无法加载 Main-Class list 属性

java - 单元测试用例中的空 @Autowired beans

java - 如何解决这个 IntelliJ 问题?

java - 使用java源码包

java - Spring Boot 无法解析 Thymeleaf View

spring-mvc - 如何使用 thymeleaf 包含外部 javascript 文件?

spring - 在没有 Spring Security 的情况下,DelegatingFilterProxy 在 Spring MVC 应用程序上调用了两次

java - 当我更改类中对象的字段时,Spring/Hibernate 会自动更新数据库

java - thymeleaf th :each adding coma between elements