[ https://issues.apache.org/jira/browse/FREEMARKER-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16335573#comment-16335573 ]
Daniel Dekany commented on FREEMARKER-87: ----------------------------------------- {{someString.class}} doesn't work in general in FreeMarker. Pure {{BeansWrapper}} (which is pretty much deprecated, except in Struts maybe) does wrap {{String}}-s into {{StringModel}} which allows that, but that's just a weird exception, and I wouldn't utilize that. Like if you assign a string literal to the variable in a template, {{someString.class}} won't work anymore. Struts FreeMarker support was made long ago based on some now very old FreeMarker version, and somehow back then they have ended up using a hack like calling Java API methods instead of improving FreeMarker's core capabilities... It's a bad situation. As of {{FriendlyMapModel}}, I guess it should work. Now I understand that the goal is that it's compatible with old Struts templates, yet {{?keys}}, {{?values}}, and {{#list ... as k, v}} are practically usable. Certainly it would make sense to add a {{BeansWrapper}} setting for that (something like {{boolean hideMethodsWhenListing}}). > <#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)