freeMarker中list的两列展示
2015-09-22 09:43
148 查看
前台界面中我使用freeMarker的机会有很多,自然也就会接触下<List>标签,我想大家应该都不陌生。<#list attrList as attr>${a.name}</#list>类似的用法很多,但是偶尔会用到两列的展示效果我们改怎么办呢?我们可以根据模型中的int类型的某一列,一般是自动增长的id标识列。如果你设计的表中 没有这样类型的列,那么就不用往下看了。
<#list attrList as attr> <#if attr_index%2 ==0> <#if attr_index==0> <tr> <#else> </tr><tr> </#if> </#if> <th width="118">${attr.key!}:</th> <td>${attr.value!}</td> <#if attr_index==attrList?size-1> <#if attr_index%2 ==1> </tr> <#else> <th width="118"></th> <td></td></tr> </#if> </#if> </#list>
相关文章推荐
- nodejs安装autoprefixer
- 第一章 安装和运行python
- Spring中使用json和前端ajax交互
- 解决安卓启动界面白色/黑色瞬间
- does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE
- 如何更专业的使用Chrome开发者工具
- javascript在调试bug的奇淫技巧(Chrome, Firebug, Filddle 调试)
- 【思想感悟】——重新认识今目标
- mongodb 执行js脚本
- Servlet 与 CGI的区别
- FPGA小白的第一篇博客
- __stdcall和__cdecl的区别
- 各个收藏网址
- 解决Warning: scandir() has been disabled for security reasons in…的问题
- 简书 技术更新网站
- 动态加载多国语言 ---- cookie + 浏览器
- jQuery实现气球弹出框式的侧边导航菜单效果
- 编写代码过程中,注意事项
- oracle表关联方式错误导致不出结果
- 棋牌源码下载出租出售维护