【问题标题】:getting Exception evaluating SpringEL expression: error in thymeleaf获取评估 SpringEL 表达式的异常:百里香叶中的错误
【发布时间】:2017-10-17 10:32:17
【问题描述】:

我正在尝试替换百里香模板中的单引号 (') 字符。由于我们的编码将其转义为',而客户端期望它是'

为了实现快速修复,我计划将负载中所有出现的单引号 (') 字符替换为空格。但是,这样做,我收到以下错误:

评估 SpringEL 表达式的异常:

我用过的替换表达式:

<th:block th:with="Description=${op.jpText('$.short_description')}">
  <u_short_description  th:text="${#strings.replace(Description,''',' ')}"></u_short_description>
</th:block>

任何帮助将不胜感激。提前致谢!

【问题讨论】:

标签: thymeleaf parse-error


【解决方案1】:

应该是

<th:block th:with="Description=${op.jpText('$.short_description')}">
  <u_short_description th:text="${#strings.replace(Description,'''',' ')}" />
</th:block>

您没有正确转义 replace 中的单引号。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-20
    • 1970-01-01
    • 2019-05-24
    • 2018-07-08
    • 2023-01-03
    • 1970-01-01
    • 1970-01-01
    • 2018-02-20
    相关资源
    最近更新 更多