Skip to content

Instantly share code, notes, and snippets.

@hbrls
Last active May 24, 2016 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hbrls/ddcd2c1ca5a225e8cbd607b02ae4b7cc to your computer and use it in GitHub Desktop.
Save hbrls/ddcd2c1ca5a225e8cbd607b02ae4b7cc to your computer and use it in GitHub Desktop.
There should be one-- and preferably only one --obvious way to do it.
${.version}  当前 freemarker 的版本
${.locale?lower_case?replace("_", "-")}  当前 Locale,例 en-us

${userName!"John"}  为空的时候不报错,给一个默认值
<#import "debugger.ftl" as debugger />
<@debugger.debug depth=3 />
<@debugger.debugDynamic />
<#import "json.ftl" as json>
<script>
var model = <@json.stringify your_model_here />;
</script>

auto append ;jsessionid bug

Directive

  1. Directives
  2. Defining your own directives

Related Articles

  1. Official FAQ
  2. Introduction to FreeMarker Template (FTL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment