Comments in freemarker template and smooks

SikanderAhmed picture SikanderAhmed · Dec 3, 2013 · Viewed 19.2k times · Source

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?

Answer

obourgain picture obourgain · Dec 3, 2013

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.