freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yanming Zhou (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FREEMARKER-87) <#list map as key,value> should always iterating on map entries
Date Tue, 23 Jan 2018 01:23:00 GMT

    [ https://issues.apache.org/jira/browse/FREEMARKER-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16335247#comment-16335247
] 

Yanming Zhou edited comment on FREEMARKER-87 at 1/23/18 1:22 AM:
-----------------------------------------------------------------

SimpleMapWrapper failed with this case

{code}
<#list map as key,value>${key.class.simpleName} ${value.class.simpleName}</#list>
{code}
{code}
FreeMarker template error:
For "." left-hand operand: Expected a hash, but this has evaluated to a string (wrapper: f.t.SimpleScalar):
==> key  [in template "" at line 1, column 27]
{code}
Actually calling method on a {{Map}} is common case in struts2 application because it allow
to do. is there any side effect to use this FriendlyMapModel?



was (Author: quaff):
Actually calling method on a {{Map}} is common case in struts2 application because it allow
to do. is there any side effect to use this FriendlyMapModel?

> <#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)

Mime
View raw message