Search code examples
javafreemarkersmooks

Comments in freemarker template and smooks


I am working on a freemarker template and here is a sample.

<Grantor>
    <UniqueID>${(currentGrantorIndex)!?string}</UniqueID> // want to comment this line
    <Entity>${(grantor.entityTypeName)!?string}</Entity>
</Grantor>

I want to know how to write comments or comment out few lines in freemarker templates. Any idea?


Solution

  • Comment in freemarker are delimited by <#-- and -->. Everything between these delimiters will not be interpreted by freemarker and won't appear in the output.

    <Grantor>
        <#-- <UniqueID>${(currentGrantorIndex)!?string}</UniqueID> -->
        <Entity>${(grantor.entityTypeName)!?string}</Entity>
    </Grantor>
    

    See freemarker reference here.