• freemarker中遍历list<map<String,String>>


    <#list var as map>
    <tr>
     <#list map?keys as itemKey> //关键点
        <#if itemKey="fieldLabel" && map['type'] == "text" >
         <td >${map[itemKey]}</td>
        </#if>
        <#if itemKey="java_lang_String" && map['type'] == "text">
             <td >${map[itemKey]}</td>
        </#if>
       
       <#if itemKey="fieldLabel" &&  map['type'] == "file">
         <td  >${map['fieldLabel']}</td>
       </#if>
        <#if itemKey="java_io_file" && map['type'] == "file">
            <td >
          <#list "${map[itemKey]}"?split(",") as x>  //使用split函数,等同于java中的split函数
            <a href="FlowDownServlet?fileName=${x}">${x}</a>
          </#list>
        </td>
        </#if>
        </#list>
      <#if  map['type'] == "select">
       <td  >${map['fieldLabel']}</td>
       <td >
       <#list form.fields as field>
        <#if field.fieldInput.type == "select">
         <select name="props['${field.fieldName}']">
       <#list field.items as item>
         <option <#if map['java_lang_String'] == item.value>selected</#if> value="${item.value}">${item.label}</option>
       </#list>
        </select>
       </#if>
      </#list>
      </td> 
      </#if>
      
    </tr>

    </#list>

    后台传递过来的数据

    List<LinkedHashMap<String,Object>> var = SubmitManager.getInstance().getProperty(documentId);
    rootMap.put("var", var);
    template.process(rootMap, out);

    原文出处http://blog.csdn.net/lsh6688/article/details/17091277

  • 相关阅读:
    JavaScript—— scroolleftoffsetleft 系列的含义以及浏览器兼容问题
    GCD
    Treap
    快速* 模板
    线性筛素数
    珂朵莉树
    One Night
    长整数相加运算(内含减法)。。= =
    骑士周游 非完美版。。= =
    《Windows取证分析》
  • 原文地址:https://www.cnblogs.com/pyfreshman/p/4702707.html
Copyright © 2020-2023  润新知