1
开始于Thymeleaf并有一个问题。我有Thymeleaf th:text如何将静态文本添加到动态值
<tr th:each="it,row : ${res.answers}">
<td th:class="${row.even}? 'even' : 'odd'" th:text="${row.count}">
1
</td>
<td th:class="${row.even}? 'even' : 'odd'" th:text="${it.question}">
Value1
</td>
<td th:class="${row.even}? 'even' : 'odd'" th:text="${it.correctAnswer}">
col2
<a href="" th:onclick="'showExplanation(\'' + ${it.comment} + '\');'">
<sup>Explanation</sup>
</a>
</td>
<td th:class="${row.even}? 'even' : 'odd'" th:text="${it.answer}">
col3
</td>
</tr>
迭代与${it.correctAnswer}
该生产线是一个应该被格式化为以下几点:
当且仅当没有在${it.comment}
那么它应该被附加上标串“解释”空字符串当我们点击这个字符串时,会调用一些Javascript函数。
我上面的解决方案显然不起作用,但有什么方法可以在运行时为Thymeleaf生成的动态值添加一些静态html代码。
我所试图做的是:
大卫它的工作。我不得不添加缺少的双引号,然后它的工作。谢谢 – Tony