我正在制作一个Freemarker模板,这里是一个示例。
<Grantor>
<UniqueID>${(currentGrantorIndex)!?string}</UniqueID> // want to comment this line
<Entity>${(grantor.entityTypeName)!?string}</Entity>
</Grantor>
我想知道如何在Freemarker模板中编写注释或将几行注释掉。 有任何想法吗?
我正在制作一个Freemarker模板,这里是一个示例。
<Grantor>
<UniqueID>${(currentGrantorIndex)!?string}</UniqueID> // want to comment this line
<Entity>${(grantor.entityTypeName)!?string}</Entity>
</Grantor>
我想知道如何在Freemarker模板中编写注释或将几行注释掉。 有任何想法吗?
在Freemarker中,注释以<#--
和-->
为定界符。这些定界符之间的所有内容都不会被Freemarker解析,不会出现在输出中。
<Grantor>
<#-- <UniqueID>${(currentGrantorIndex)!?string}</UniqueID> -->
<Entity>${(grantor.entityTypeName)!?string}</Entity>
</Grantor>
请查看freemarker参考 这里.
使用if标签在freemarker中添加注释的另一种非标准方式:
<#if 1=0>comment</#if>
或者
<#if false>comment</#if>