我是靠谱客的博主 老实滑板,这篇文章主要介绍freemarker list用法,现在分享给大家,希望可以做个参考。

 后端数据组织

  Map<String, Object> map = new HashMap<>();
 List<TopnItem> topnItems = iTopnService.getTopn(jobId, "home");
map.put("topn", topnItems.subList(0, 10));

 前端根据map中的key:topn获取数据

<tr bgcolor="#FFFFFF">

        <th style="font-family: '宋体', Arial; font-size: 14px; line-height: 36px;" align="center"> &nbsp;搜索词</th>
        <th style="font-family: '宋体', Arial; font-size: 14px; line-height: 36px;" align="center"> &nbsp;类别</th>
        <th style="font-family: '宋体', Arial; font-size: 14px; line-height: 36px;" align="center"> &nbsp;城市</th>
        <th style="font-family: '宋体', Arial; font-size: 14px; line-height: 36px;" align="center"> &nbsp;重复率/匹配度</th>
        <th style="font-family: '宋体', Arial; font-size: 14px; line-height: 36px;" align="center"> &nbsp;搜索次数</th>
        <th style="font-family: '宋体', Arial; font-size: 14px; line-height: 36px;" align="center"> &nbsp;词性分析</th>
        <#if topn?? && (topn?size > 0)>
            <#list topn as lender>
                <tr>
                    <td style="font-family: '宋体', Arial; font-size: 12px; line-height: 36px;" align="center" width="15%">&nbsp;${lender.keyword!""}</td>
                    <td style="font-family: '宋体', Arial; font-size: 12px; line-height: 36px;" align="center" width="15%"> &nbsp;${lender.category!""}</td>
                    <td style="font-family: '宋体', Arial; font-size: 12px; line-height: 36px;" align="center" width="15%">&nbsp;${lender.localname!""}</td>
                    <td style="font-family: '宋体', Arial; font-size: 12px; line-height: 36px;" align="center"><a href="${topnUrl}/${lender.jobIdString}/${lender.idString}">${lender.repeatDtail!""}</a></td>
                    <td style="font-family: '宋体', Arial; font-size: 12px; line-height: 36px;" align="center" width="15%">&nbsp;${lender.searchNum!""}</td>
                    <td style="font-family: '宋体', Arial; font-size: 12px; line-height: 36px;" align="center" width="15%">&nbsp;${lender.keywordCategorys!"暂无"}</td>
                </tr>
            </#list>
        <#else>
        </#if>
    </tr>

 

最后

以上就是老实滑板最近收集整理的关于freemarker list用法的全部内容,更多相关freemarker内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(116)

评论列表共有 0 条评论

立即
投稿
返回
顶部