Old FTL syntax

With the old FTL syntax the # was not required (prior 2.1 not even allowed) in the FTL tags. For example, you could write this:

<html>
<head>
  <title>Welcome!</title>
</head>
<body>
  <h1>Welcome ${user}!</h1>
  <p>We have there animals:
  <ul>
  <list animals as being>
    <li>${being.name} for ${being.price} Euros
  </list>
  </ul>
  <include "common_footer.html">
</body>
</html>  

While the #-less syntax was more natural for HTML authors, it had too many drawbacks, so finally we have decided to deprecate it. With the newer syntax (a.k.a ``strict syntax''), the # is strictly required. That is, things like <include "common_footer.html"> will go to the output as is, since they are not considered as FTL tags. Note that user-defined directives use @ instead of #.

However, to give users time to prepare for this change, in FreeMarker 2.1 and 2.2 the usage of # is optional, unless the programmer enables strict syntax mode in the FreeMarker configuration by calling setStrictSyntaxMode(true) on Configuration. In fact, we strongly recommend this to programmers. Starting from some later release this setting will be initially set to true. Also, you can specify if you want to use strict syntax or old syntax in the template files with the ftl directive.

The advantages of ``strict syntax'' over the legacy FTL syntax are:

FreeMarker Manual -- For FreeMarker 2.3.20
HTML generated: 2013-06-27 20:54:33 GMT
Edited with XMLMind XML Editor
Here!