我有下一个百里香代码:

<select class="custom-select" th:field="*{...}">
  <option th:value="Given" th:text="Given">Given</option>
  <option th:value="When" th:text="When" selected>When</option>
  <option th:value="And" th:text="And">And</option>
  <option th:value="Then" th:text="Then">Then</option>
</select>


“ and”是theamleaf中的布尔运算符,像这样使用它会引发en错误“无法将其解析为表达式”。
我尝试了ascii字符,但结果是相同的。
还尝试使用俄语A字符代替拉丁字符,但这对我不起作用,因为我将从此输入生成.feature文件,并且黄瓜不识别俄语字符。

因此,有人知道如何在百里香中逃脱操作员吗?
我现在看到的唯一方法是使用俄语字符,然后在运行系统中将其替换为拉丁文A,但这看起来过于复杂。

最佳答案

尝试:

<option th:value="'And'" th:text="'And'">And</option>

关于java - 如何在 thymeleaf 中逃脱'And'运算符,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59326432/

10-13 09:47