Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

FreeMarker by default uses the "<#directive />" syntax. FreeMarker supports an alternative syntax, where [ and ] are used instead of < and >. To enable the alternative syntax, add [#ftl] at the beginning of the template. The alternative syntax makes it easier to differentiate between FreeMarker directives, and JSP or HTML tags.

Code Block
XML
XML
titleUse alternative syntax
[#ftl]
<html>
   <head>FreeMarker Example</head>
    
   <body>
       <h1>Alternative Syntax</h1>
       [@s.if test="printName"]
          [@s.property value="myBeanProperty" /]
       [/@s.if]
   </body>
</html>

(lightbulb) There are a number of IDE plugins available for FreeMarker. But, if your IDE is not on the list, then the using alternative syntax will avoid conflicts between FreeMarker and the HTML syntax highlighting provided by your IDE.