【发布时间】:2016-12-24 22:23:30
【问题描述】:
我有问题。我想显示用户的兴趣列表(或用户没有兴趣的示例)。我需要为我的 TAG-IT 库使用 li 标签来处理它们。这是必须的!
所以我在 thymeleaf 中做了一个 IF,我需要将它与 div 中的 li 标签混合。它为 TAG-IT 库显示了一堆项目符号(兴趣列表),以将它们显示为用户的标签。但是当用户没有附加标签时,我有另一个 IF 来显示带有消息的标签。
我认为我的解决方案应该可行,但结果是它显示了用户的兴趣,而且还应该只在用户是新用户(并且还没有注册兴趣)时显示。就像第二个 IF 不起作用并且总是显示。
<div id="interestDiv">
<ul id="interestList">
<li th:if="${interest} != null" th:each="interest : ${profile.interests}" th:text="${interest.name}">ID data</li>
<li th:if="${interest} == null" th:text="'add your interest here (example: music ! )'">ID data</li>
</ul>
【问题讨论】:
标签: spring if-statement thymeleaf tag-it