小编mar*_*uta的帖子

方法调用:在类型 org.thymeleaf.expression.Dates 上找不到方法格式(java.time.LocalDate,java.lang.String)

我在何时在 thymeleaf 中使用想要 java8time 表达式时遇到问题。当我使用 #dates.format 时出现此错误:

org.springframework.expression.spel.SpelEvaluationException:EL1004E:方法调用:在类型 org.thymeleaf.expression.Dates 上找不到方法格式(java.time.LocalDate,java.lang.String)

<div class="row">
<div class="col-2"  th:each="t:${horaire.terrains}">
    <h2 th:text="${t.nomTerrain}"></h2>
    <table border="1px">

        <tr  th:each="h,index : ${heures.subList(0,15)}"   >

            <td>
                <p th:text="${#dates.format(date,'dd-MM-yyyy')}">

                </p>

            </td>
            <td>





                <a th:text="${h}" th:href="@{addResa(heure=${h} , terrain=${t.id} ,date=${date},date2=${index.index+1}, listeHeures = ${heures} )}"></a>

            </td>
        </tr>




    </table>
</div>
Run Code Online (Sandbox Code Playgroud)

这是我的依赖项

http://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0

<groupId>mereuta.marian</groupId>
<artifactId>tennis01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>tennis01</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.BUILD-SNAPSHOT</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring3 …
Run Code Online (Sandbox Code Playgroud)

thymeleaf spring-boot

6
推荐指数
1
解决办法
9380
查看次数

标签 统计

spring-boot ×1

thymeleaf ×1