split分割:用来根据另外一个字符串的出现将原字符串分割成字符串序列
freemarker中的split字符串分割:
<#list "张三三,李思思,,王强,柳树,诸葛正我"?split(",") as name>
${num}
</#list>
实战举例:
<div class="fields" style="display: none" id="attend">
<table class="ui very compact selectable celled table" >
<thead>
<tr><th colspan="2">签到表</th></tr>
<tr>
<th>参会人员</th>
<th>签到人员</th>
</tr>
</thead>
<tbody>
<#list bad.joinman?split(",") as joinman>
<tr style="line-height: 1.5em;">
<td width="30%">${joinman}</td>
<td style="text-align: left">
</td>
</tr>
</#list>
</tbody>
</table>
</div>
freemarker中文官方参考手册:
http://freemarker.foofun.cn/dgui_quickstart_template.html#autoid_4
其他参考文献:
https://www.iteye.com/blog/demojava-800204
https://www.cnblogs.com/ccw95/p/7251660.html
freemarker 索引值:举例:除下标为0的内容外其他加上逗号,1 ,2 ,3
<#list attendUser as list1>
<#if list1_index!=0>,</#if>${list1.attend_name}
</#list>
freemarker 声明变量:举例:多重循环自定义下标为0,同行下标++;换行后下标再次为0,下标++
<#assign x=0/>
<#assign x = x + 1/> 循环
<#list deptInfo as list>
<#if batch.attend_batch=list.attend_batch>
<tr style="line-height: 2em;">
<td width="30%">${list.dept_name}</td>
<td style="text-align: left">
<#assign x=0/>
<#list attendUser as list1>
<#if list.dept_id==list1.dept_id && list.attend_batch==list1.attend_batch>
<#if x!=0>,</#if>${list1.attend_name}
<#assign x = x + 1/>
</#if>
</#list>
</td>
<td id="curdentcount"></td>
</tr>
</#if>
</#list>
示例图如下: