1.下载fmpp [url]http://fmpp.sourceforge.net/[/url]
2.解压缩在如F:\work下
[img]http://dl.iteye.com/upload/attachment/336663/69a125dd-ca19-304a-9219-062f256cb147.bmp[/img]
3.环境变量path中设置F:\work\fmpp\bin
[img]http://dl.iteye.com/upload/attachment/336681/4e7cb5e0-4a48-3d91-98c2-9b15a123c38b.bmp[/img]
4.在F:\work下建立如下的文件夹和配置文件
[img]http://dl.iteye.com/upload/attachment/336673/e013a229-b1ef-3377-9921-9524632f4ba1.bmp[/img]
文件夹src下存放ftl模板文件,data下存放数据模型,out下运行fmpp后生成的输入html文件,config.fmpp是fmpp的配置文件。
5.src下建立product.ftl文件
<html>
<head>
<title>Welcome!</title>
</head>
<body>
<h1>Welcome ${user}!</h1>
<p>Our latest product:
<a href="${latestProduct.url}">${latestProduct.name}</a>!
<#if 1==1>
<h1>if语句</h1>
</#if>
</body>
</html>
6.data下建立product.tdd文件
{
user: "Big Joe"
latestProduct: {url: "products/greenmouse.html", name: "Green Mouse"}
}
7.config.fmpp文件内容
sourceRoot: src
outputRoot: out
logFile: log.fmpp
modes: [
copy(common/**/*.*, resource/*.*)
execute(*.ftl)
ignore(templates/*.*, .project, **/*.xml, xml/*.*, *.js)
]
replaceExtensions: [ftl, html]
sourceEncoding: gb2312
data: tdd(../data/product.tdd)
8.cmd进入F:\work下,输入fmpp,则out文件夹下产生product.html文件
<html>
<head>
<title>Welcome!</title>
</head>
<body>
<h1>Welcome Big Joe!</h1>
<p>Our latest product:
<a href="products/greenmouse.html">Green Mouse</a>!
<h1>if语句</h1>
</body>
</html>