码迷,mamicode.com
首页 > 其他好文 > 详细

thymleaf分支用法

时间:2015-06-02 19:44:22      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

<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>

 

thymleaf分支用法

标签:

原文地址:http://www.cnblogs.com/feika/p/4547420.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!