[
https://issues.apache.org/jira/browse/FREEMARKER-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16169750#comment-16169750
]
Josh Wang commented on FREEMARKER-72:
-------------------------------------
Thanks a lot. As your advices, I changed the code and the result is right now.
*macro.ftl*
{code:java}
<#macro showId ns>${ns.id}</#macro>
{code}
*index.ftl*
{code:java}
<#import "p1.ftl" as p1><@p1.showId p1/><#-- @showId == p1 -->
<#import "p2.ftl" as p2><@p2.showId p2/><#-- @showId == p2 -->
<@p1.showId p1/><#-- @showId == p1 -->
{code}
> Import 2 different files which include 1 same file makes vars the same
> ----------------------------------------------------------------------
>
> Key: FREEMARKER-72
> URL: https://issues.apache.org/jira/browse/FREEMARKER-72
> Project: Apache Freemarker
> Issue Type: Bug
> Components: engine
> Affects Versions: 2.3.26-incubating
> Reporter: Josh Wang
>
> Four Files:
> *p1.ftl*
> {code:java}
> <#assign id="p1"><#include "macro.ftl">
> {code}
> *p2.ftl*
> {code:java}
> <#assign id="p2"><#include "macro.ftl">
> {code}
> *macro.ftl*
> {code:java}
> <#macro showId>${id}</#macro>
> {code}
> *index.ftl*
> {code:java}
> <#import "p1.ftl" as p1><@p1.showId /><#-- @showId == p1 -->
> <#import "p2.ftl" as p2><@p2.showId /><#-- @showId == p2 -->
> <@p1.showId /><#-- Why @showId == p2 ??? -->
> {code}
> First call <@p1.showId /> show the right result. But after call <@p2.showId
> />, if you call <@p1.showId /> again, the result is wrong.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)