freemarker中的split字符串分割:

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>

示例图如下:
在这里插入图片描述

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值