thymleaf分支用法

<div th:switch="${user.role}"> 
  <p th:case="'admin'">User is an administrator</p>
  <p th:case="#{roles.manager}">User is a manager</p>
  <p th:case="*">User is some other thing</p> 
</div>

<div th:with="condition=${potentially_complex_expression}" th:remove="tag">
    <h2 th:if="${condition}">Hello!</h2>
    <span th:unless="${condition}" class="xxx">Something else</span>
</div>

wrong:
<div th:if="${condition}" th:replace="path/to/fragment : #fragmentId"></div>

 

posted @ 2015-06-02 18:39  samu  阅读(441)  评论(0编辑  收藏  举报