[ https://issues.apache.org/jira/browse/FREEMARKER-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16333950#comment-16333950 ]
Daniel Dekany commented on FREEMARKER-87: ----------------------------------------- In rare cases where calling method on a {{Map}} is needed (as opposed to using {{?values}}, {{?keys}} and {{#list map as k, v}}), you can use {{map?api.someJavaMethod()}}. (But calling Java methods directly means that your template will depend on if a variable is a real {{Map}} or just something wrapped as {{TemplateHashModel}}.) Also note that the template language has no separate namespace for methods and plain variables, that is, if {{foo.m()}} works, then {{foo.m}} and {{foo["m"]}} returns the method itself as value. Hence it's logical that then {{m}} is among the keys as well, and hence it better if it's not a hash item at all. > <#list map as key,value> should always iterating on map entries > --------------------------------------------------------------- > > Key: FREEMARKER-87 > URL: https://issues.apache.org/jira/browse/FREEMARKER-87 > Project: Apache Freemarker > Issue Type: Bug > Components: engine > Affects Versions: 2.3.27-incubating > Reporter: Yanming Zhou > Priority: Major > Attachments: MapIteratingTest.java > > > I'm using struts2, use FriendlyMapModel instead of default MapModel, It works > fine except map have key such as "size", the value will be unexpected > SimpleMethodModel, I think freemarker should always use entry value for > directive <#list map as key,value>, not matter how MapModel works, MapModel > should only affect map.size and map.get('size'). > I attached a test case. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)