【发布时间】:2021-01-06 10:38:02
【问题描述】:
我将模型对象传递给要在表单中使用的视图。尽管如此,我需要取消其中一个参数,当我使用 #uris.unescapePathSegment 时 Springboot 会抛出错误,因为它找不到相关的 bean
代码
<tr>
<td colspan="8"><textarea rows="15" cols="150"
th:field="${#uris.unescapePathSegment(excerpt.comments)}" /></textarea></td>
<td class="validation-comments" colspan="5"
th:if="${#fields.hasErrors('excerpt.comments')}"
th:errors="${excerpt.comments}"></td>
</tr>
错误
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name '#uris' available as request attribute
我应该如何解决这个问题?在现场使用之前,是否可以在 Thymeleaf 中取消转义参数,还是应该在控制器中取消转义?
【问题讨论】:
标签: forms spring-boot thymeleaf