<a th:href="@{'/newsDetail?id='+${item.id}}">
- 格式化成标准日期: HH :代表24小时,hh :代表12小时制,例如将startTime转成yyyy-MM-dd HH:mm
<span th:text="${#dates.format(activity.startTime, 'yyyy-MM-dd HH:mm')}"></span>
- 日期的比较: gt(大于) lt(小于) eq(等于) !=(不等于) ==(等于),例如判断当前日期是否小于applyDeadline
<span th:if="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')} lt ${#dates.format(activity.applyDeadline, 'yyyy-MM-dd HH:mm:ss')}">
- url的拼接:单个参数 以及 多个参数,item 为object
<a th:href="@{'/newsDetail?id='+${item.id}}">
<div th:href="@{/Culturecloud/dispDetail(id=${item.id},flag=${'6'})}"></div>
<img th:src="@{'/upload/activity/'+${item.activityImg}}" "javascript:this.src='../statics/images/no-pictures.png';">
- 对于list集合的判断: th:if 以及 th:unless
<div th:if="${#lists.isEmpty(heritageList)}"></div>
<div th:unless="${#lists.isEmpty(heritageList)}"></div>
- 对于list集合的循环:display 为json数据的key
<div class="item" th:each="item : ${display}"></div>
<div class="md-img" th:switch="${{item.resourceTypeid}}">
<span th:case="1"></span>
<span th:case="2"></span>
................
</div>
<!--判断是否为0-->
<span th:if="${isfinally} == 0" ></span>
<!--判断是否为空-->
<span th:if="${object } != null"></span>
<span th:utext="${cloudworks.worksContent}"></span>
<span th:text="${activity.appointmen} - ${activity.appointmen}"></span>
- 对于字符串的函数处理:book 是一个数组,3 是下标,book[3]为字符串,+ 号 为 拼接;
<span class="active" th:data="${#strings.substring(book[3],0,10)}+'@'+${book[0]['1'].stageid}" ></span>
${#strings.indexOf(name,frag)}
${#strings.substring(name,3,5)}
${#strings.substringAfter(name,prefix)}
${#strings.substringBefore(name,suffix)}
${#strings.replace(name,'las','ler')}
<sapn th:text="${book[0]['1']}></span>
<span th:data="${data.val}" id="val"></span>
<!--在js中获取:var val= $("#val").attr("data");-->
<span th:if="${session.user != null}">
<span id="userId" hidden th:text="${session.user.id}"></span>
<span id="isVolun" th:text="${session.user.isVolun}" hidden></span>
</span>
<!--类似还有application:⽤于获取应⽤程序或servlet上下⽂属性;request:直接访问与当前请求关联的-->