- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 #strings.substr()
函数,它给出了以下错误:
There was an unexpected error
(type=Internal Server Error, status=500)
. Exception evaluating SpringEL expression:"#strings.substr(status,iter.index,iter.index+1)"
(init:37)
这是代码:
<tbody>
<tr th:each="task,iter : ${taskList}">
<td th:text="${task.id}"></td>
<td th:text="${task.task}"></td>
<td th:switch="${#strings.substr(status,iter.index,iter.index+1)}">
<div th:case="'0'"><input type="checkbox"/></div>
<div th:case="'1'"><input type="checkbox" checked="checked"/></div>
<div th:case="*"><input type="checkbox" id="checkbtn" checked="checked"/></div>
</td>
</tr>
</tbody>
这是错误日志:
Exception evaluating SpringEL expression: "#strings.substr(status,iter.index,iter.index+1)" (init:37)] with root cause
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 9): Method call: Method substr(netgloo.models.Exit,java.lang.Integer,java.lang.Integer) cannot be found on org.thymeleaf.expression.Strings type
我猜这个错误是由于 iter.index 的类型是 Integer 并且该函数需要一个 int。那么我该如何解决这个问题呢?谢谢
最佳答案
不,问题是(引用您的错误消息):
Method substr [...] cannot be found on org.thymeleaf.expression.Strings type
这意味着 #strings
没有名为 substr
的方法。您可能是指 substring
。
参见 http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#strings
关于java - Thymeleaf - 异常评估 SpringEL 表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40987802/
我的 thymeleaf 模板有这样的问题。我得到: Exception evaluating SpringEL expression: "prod.itemName" (main:18) 来自这个表
我无法将值从集合传递到 html 页面。以前它在我添加集合以仅过滤日期列表之前起作用。如果有人可以提供帮助,我们将不胜感激。 :) 具有属性“日期”的 getter/setter 的实体/类: pub
我被困在我的项目中,我在网站的另一页上有一个看似相同的设置,但我无法让这个工作。 DemoApplication.java @GetMapping("/generate") public St
我正在使用 #strings.substr() 函数,它给出了以下错误: There was an unexpected error (type=Internal Server Error, stat
我正在尝试保存“员工”模型,而不为其分配任何“电话”模型(oneToOne 关系)。我有一个表单,在其中我通过添加以下内容来创建员工:名字、姓氏,然后是一个下拉列表,我可以从中选择要分配的电话。每当我
我在 Spring boot 应用程序中使用 Microsoft SQL。我已经弄清楚了一切,现在我正在尝试将数据从 SQL 数据库传递到前端。但是,当我通过 thymeleaf 传递信息时,它不起作
Book.java package pl.spring.guru.spring5webapp.model; import javax.persistence.*; import java.util.H
当我尝试在我的@Preauthorize 注释中使用“或”运算符时,出现以下错误。 java.lang.IllegalArgumentException: Failed to evaluate exp
所以我正在构建一个小型锻炼日志网络应用程序。截至目前,它应该做的就是拉出锻炼并显示锻炼名称。但thymeleaf似乎不知道exerciseName是什么。我的数据库中确实有一个带有锻炼名称的锻炼,但似
我正在开发一个简单的项目来实现 Spring 安全。当我尝试使用 Spring 和 Thymeleaf 的 Logout 链接时,问题就出现了。 1.pom.xml
我是 Spring Boot 新手,并尝试使用 JPA/JPQL 在两个不相关的实体(事务和项目)之间进行联接。但是在使用 thymeleaf 以表格格式显示它时出现以下错误: 2020-04-08
我从我的 ApplicationAdvice 类中获取 currentUser 并在用户登录时将其显示在每个页面上: @ModelAttribute("currentUser") public Tmt
我是一名优秀的程序员,十分优秀!