您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > freemarker中文手册文档
FreeMarkerFreeMarkerJavaFreeMarkerHTMLWebMVCFreeMarkerJavaFreeMarkerFreeMarkerWebWebFreeMarkerHTTPServletFreeMarkerWebFreeMarkerModel2StrutsJSPFreeMarker1HTMLXMLRTFJavaServletEmailWebWeb2includeif/elseif/elseHTML3FreeMarkerJavaJavaJavaBeanXMLSQL4WebWebHTMLModel2WebJSPJSPMVC5UNICODEUS6XML#recurse#visit2.3XMLXMLFreeMarker(1)11+=FreeMarker——HTMLWebWebHTMLFreeMarkerhtmlheadtitleWelcome!/title/headbodyh1Welcome${user}!/h1pOurlatestproduct:ahref=${latestProduct.url}${latestProduct.name}/a!/body/htmlHTML${…}FreeMarkerFreeMarkerTemplateuserlatestProduct.urllatestProduct.namedatamodel(root)|+-user=BigJoe|+-latestProduct|+-url=products/greenmouse.html|+-name=greenmouselatestProductuserurlnameurlnamelatestProductFreeMarkerhtmlheadtitleWelcome!/title/headbodyh1WelcomeBigJoe!/h1pOurlatestproduct:ahref=products/greenmouse.htmlgreenmouse/a!/body/html2(root)|+-animals|||+-mouse|||||+-size=small|||||+-price=50|||+-elephant|||||+-size=large|||||+-price=5000|||+-python|||+-size=medium|||+-price=4999|+-test=Itisatest|+-whatnot|+-because=don'tknowhashesscalarsscalarsscalarsroot“.animals.mouse.pricesequenceshashes(root)|+-animals|||+-(1st)|||||+-name=mouse|||||+-size=small|||||+-price=50|||+-(2nd)|||||+-name=elephant|||||+-size=large|||||+-price=5000|||+-(3rd)|||+-name=python|||+-size=medium|||+-price=4999|+-whatnot|+-fruits|+-(1st)=orange|+-(2nd)=bananascalarsanimals[0].name3FreeMarker${…}interpolationsFreeMarkerFTLFreeMarkerHTMLHTML#@#----!----if#ifanimals.python.priceanimals.elephant.pricePythonsarecheaperthanelephantstoday.#elsePythonsarenotcheaperthanelephantstoday./#iflistpWehavetheseanimals:tableborder=1trthNamethPrice#listanimalsasbeingtrtd${being.name}td${being.price}Euros/#list/tablepWehavetheseanimals:tableborder=1trthNamethPricetrtdmousetd50Eurostrtdelephanttd5000Eurostrtdpythontd4999Euros/tableincludehtmlheadtitleTestpage/title/headbodyh1Testpage/h1pBlahblah...#include/copyright_footer.html/body/htmlpWehavetheseanimals:tableborder=1trthNamethPrice#listanimalsasbeingtrtd#ifbeing.size=largeb/#if${being.name}#ifbeing.size=large/b/#iftd${being.price}Euros/#list/tableFreeMarker(3)31FTLFreeMarkerInterpolation${}#{}FTLFreeMarkerHTML##----html[BR]head[BR]titleWelcome!/title[BR]/head[BR]body[BR]#--Greettheuserwithhis/hername--[BR]h1Welcome${user}!/h1[BR]pWehavetheseanimals:[BR]ul[BR]#listanimalsasbeing[BR]li${being.name}for${being.price}Euros[BR]/#list[BR]/ul[BR]/body[BR]/html[BR]FTLlistFTLList${name}${NAME}InterpolationFTLFTL#if#include'foo'='bar'.../ifFTLInterpolationh1Welcome${user#--Thenameofuser--}!/h1[BR]pWehavetheseanimals:[BR]ul[BR]#list#--somecomment...--animalsas#--again...--being[BR]...2FreeMarkerFTLFTLHTML#directivenameparameters/#directivename#directivenameparameters/@#@mydirective.../@mydirectiveFTLul#listanimalsasbeingli${being.name}for${being.price}Euros#ifuse=BigJoe(exceptforyou)/#list/#if#--WRONG!--/ulFreeMarkerFreeMarkerFTL#list[BR]animalsas[BR]being[BR][BR]${being.name}for${being.price}Euros[BR]/#list/3${It's\quoted\andthisisabackslash:\\}${'It\'squotedandthisisabackslash:\\'}It'squotedandthisisabackslash:\It'squotedandthisisabackslash:\\(u0022)\'(u0027)\\(u005C)\n(u000A)\rReturn(u000D)\tTab(u0009)\bBackspace(u0008)\fFormfeed(u000C)\l\g\a&\{{\xCode416Unicoderaw\{r${r${foo}}${rC:\foo\bar}${foo}C:\foo\bar“.“1E30“.58+8088.00truefalse#list[winter,spring,summer,autumn]asx${x}/#listwinterspringsummerautumn[2+2,[1,2,3,4],whatnot]2..5[2,3,4,5]5..2hash/{name:greenmouse,price:150}${variable}$@#(root)|+-book|||+-title=Breedinggreenmouses|||+-author|||+-name=JuliaSmith|||+-info=Biologist,1923-1985,Canada|+-test=titlebook.author.namebook[author].namebook.author.[name]book[author][name]0[startIndex..endIndex]startIndexendIndexFreeMarker.variablenameInterpolation${..}#{..}${Hello${user}!}${${user}${user}${user}${user}}+${Hello+user+!}${user+user+user+user}${..}#if${isBig}Wow!/#if#if${isBig}Wow!/#if#ifisBigWow!/#ifuser“BigJoe${user[0]}${user[4]}${user[1..4]}0BJigJ+#list[Joe,Fred]+[Julia,Kate]asuser-${user}/#list-Joe-Fred-Julia-Kate+key#assignages={Joe:23,Fred:25}+{Joe:30,Julia:18}-Joeis${ages.Joe}-Fredis${ages.Fred}-Juliais${ages.Julia}-Joeis30-Fredis25-Juliais18${x*x-100}${x/2}${12%10}x5-752.52${3*5}#--WRONG!--+${3+5}35int${(x/2)?int}${1.1?int}${1.999?int}${-1.1?int}${-1.999?int}x5211-1-1===!==!=#if1=1FreemarkerxxX==FreemarkerFTL=#if(xy)ltltegtgte==&&and||or!not#ifx12&&color=greenWehavelessthan12things,andtheyaregreen./#if#if!hot#--herehotmustbeaboolean--It'snothot./#if“?“.htmlHTMLcap_firstlower_caseupper_casetrimsizeint-1.9?int-1testTom&Jerry${test?html}${test?upper_case?html}Tom&JerryTOM&JERRY[subvarName][subStringRange].(methodParams)+expr-expr!?*/%+-==ltltegtgte===!=and&&or||..4Interpolatio
本文标题:freemarker中文手册文档
链接地址:https://www.777doc.com/doc-4821353 .html