项目组的同仁在freemarker里面,用到hashmap的时候出了错误。经过研究发现:

       原来是因为freemarker里面没有TypeConverter机制,如果Map里面的Key是Object(String,Integer,etc)就有问题------key只能是字符串。 

     The example  is given

         Map testMap = new HashMap();
         optionMap.put("sh", "shanghai ");
         optionMap.put("bt", "北京 ");
   freemarker显示hashmap存取的格式如下

  <#list testMap?keys as testKey>
       < option value="${testKey}" >
               ${testMap[testKey]}
     </option>
<
/#list>

 ---- TerryChan        http://blog.donews.com/terrychan  

 




Trackback: http://tb.donews.net/TrackBack.aspx?PostId=1145388


[点击此处收藏本文]  发表于2007年03月27日 6:39 PM




正在读取评论……
添加评论
大名
网址


验证码
评论