#if, #elseif ,#end,#foreach 的使用, #if嵌套

单独使用foreach:

#foreach($tableDO in ${tableList})

#end

单独使用#if:

#if (a=='0')

      我是数字0

#end

#if 和#else 结合使用:

#if(a=='0')

    我是数字0

#else

    我不是数字0

#end

#if , #elseif 和#else 结合使用:

#if(a=='0')

    我是数字0

#elseif(a=='1')

    我是数字1

#else (a=='2')

    我是数字2

#end

两个#if嵌套:

#if()

     #if()

     #else

     #end

#end

同时支持#foreach 内 嵌套#if ;

案例:

<table class="table table-striped table-hover table-bordered" id="sample_editable_1">

<thead>

<tr>

 

<th>确认人</th>

 

<th>状态</th>

 

<th>操作</th>

 

</tr>

 

</thead>

 

<tbody>

#foreach($transferRecordTableDO in ${transferRecordTableList})

<tr>

 

<th>$!{transferRecordTableDO.confirmUser}</th>

#if ($!{transferRecordTableDO.status}=='0')

<th>未处理</th>

#if(($!{transferRecordTableDO.createUser})==($!{loginName}))

<th>

<button type="" class="btn gray start" disabled="disabled">

<span>确认按钮禁用</span>

</button>

</th>

#else

<th>

<button type="button" class="btn blue start">

<span>确认按钮正常</span>

</button>

</th>

#end

#elseif ($!{transferRecordTableDO.status}=='1')

<th>已确认(不显示确认按钮)</th>

<th></th>

#else ($!{transferRecordTableDO.status}=='2')

<th>已作废(不显示确认按钮)</th>

<th></th>

#end

</tr>

#end

 

</tbody>

 

</table>

猜你喜欢

转载自fengxiaoshuang429201406254717.iteye.com/blog/2418431
今日推荐