freeMarker中list的兩列展示

2022-08-19 10:30:09 字數 383 閱讀 5644

前台介面中我使用freemarker的機會有很多,自然也就會接觸下標籤,我想大家應該都不陌生。<#list attrlist as attr>$類似的用法很多,但是偶爾會用到兩列的展示效果我們改怎麼辦呢?我們可以根據模型中的int型別的某一列,一般是自動增長的id標識列。如果你設計的表中 沒有這樣型別的列,那麼就不用往下看了。

<#list attrlist as attr>

<#if attr_index%2 ==0>

<#if attr_index==0>

<#else>

$:$<#if attr_index==attrlist?size-1>

<#if attr_index%2 ==1>

<#else>

Freemarker中如何遍歷List

freemarker中如何遍歷list 在freemarker應用中經常會遍歷list獲取需要的資料,並對需要的資料進行排序加工後呈現給使用者。那麼在freemarker中如何遍歷list,並對list中資料進行適當的排序呢?一 freemarker中list指令簡單介紹 要想在freemarker...

Freemarker中如何遍歷List

freemarker中list指令簡單介紹 要想在freemarker中遍歷list,必須通過使用list指令,即 list sequence as item sequence是集合 collection 的表示式,item是迴圈變數的名字,不能是表示式。當在遍歷sequence時,會將遍歷變數的值...

freemarker的list指令中隱藏的變數

freemarker的list指令遍歷乙個list集合中的每乙個元素,例如 list userlists as user 其實list指令還隱含了兩個變數,1 item index 該變數將返回元素在集合裡的索引值,從0開始計數 2 item has next 該變數是boolean型,false表...