0
我的代碼是這樣的:評估2個條件表達式在第一個:如果第或:除非
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header" th:utext="#{dashboard}">Dashboard</h1>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" th:if="${lista}">
<h1 class="page-header" th:text="#{__${name}__}"></h1>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" th:if="${command}">
<h1 class="page-header"><th:block th:utext="#{__${action}__}"/> <th:block th:utext="#{__${name}__}"/></h1>
</div>
如果lista
不爲空的第二<div>
塊被顯示。當command
不爲空時顯示第三個。當lista
和command
都爲空時,應顯示第一個。類似的東西:
${lista} && ${command}
但這個表達式會導致錯誤。任何人都知道如何做到這一點?
UPDATE
我嘗試:${lista && command}
和${lista and command}
但不解決我的問題(仍然happenning錯誤)。
的可能的複製[如何在一個個多重條件:如果使用標籤thymeleaf(http://stackoverflow.com/questions/16018577/how-到具有-多個輸入條件-AN-THIF標籤的使用-thymeleaf) – Andrew