05月15, 2018

java模板之freemarker

if

<#if animals.python.price < animals.elephant.price>
  Pythons are cheaper than elephants today.
<#elseif animals.elephant.price < animals.python.price>
  Elephants are cheaper than pythons today.
<#else>
  Elephants and pythons cost the same today.
</#if>

<#if user??><h1>Welcome ${user}!</h1></#if>

list

<#list misc.fruits>
  <p>Fruits:
  <ul>
    <#items as fruit>
      <li>${fruit}<#sep> and</#sep>
    </#items>
  </ul>
<#else>
  <p>We have no fruits.
</#list>

include

<#include "/copyright_footer.html">

Escaping

<#ftl output_format="HTML|XML">

Basics

${cargo.weight / 2 + 100}

template

<#macro greet person color>
  <font size="+2" color="${color}">Hello ${person}!</font>
</#macro>

<@greet person="Fred" color="black"/>

本文链接:https://blog.jnliok.com/post/freemarker-start0.html

-- EOF --

Comments