Author Login
Post Reply
Hello,
I'm trying to iterate over my hashmap like this:
(first populate the map in Java):
HashMap<String,String> foo = new HashMap<String,String>();
foo.put("hey","you");
foo.put("one","two");
root.put("stuff", foo); // map passed to template.process()
Now access it in ftl:
<#list stuff?keys as key>
<h3>${key}</h3>
</#list>
I get stuff like this in my output:
put
remove
entrySet
hashCode
productElement
clear
isEmpty
hey
values
empty
underlying
productElements
copy
getClass
get
copy$default$1
equals
productPrefix
class
canEqual
keySet
size
one
containsKey
productArity
containsValue
productIterator
toString
putAll
What's all this crap? My "hey" and "one" are there--and work fine if I
access them like ${stuff["hey"]}
But I want to iterate over all my keys and don't want all this other stuff,
which looks like introspected stuff from HashMap.
Any ideas appreciated. Thanks!
Greg
--
Sent from the freemarker-user mailing list archive at Nabble.com.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
FreeMarker-user mailing list
FreeMarker-user@(protected)
https://lists.sourceforge.net/lists/listinfo/freemarker-user