action里用freeer生成静态页面:
----------------------------------------------------------------------
List newsList = new ArrayList();
newsList .add(new String("1"));
newsList .add(new String("2")); template = freeerCfg.getTemplate("newslist.ftl");
template.setEncoding("UTF-8");
File htmlFile = new File(request.getRealPath("/")+"/newslist.html");
Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(htmlFile), "UTF-8"));
template.process(newsList, out);
out.flush();
--------------------------------------------------------------------
newslist.ftl文件:
<html>
<head>
<title><title>
</head>
<body>
<#list newsList as being>
<li>${being.title}
</#list>
</body>
</html>
可是报错newsList 未定义!!!!哪里错了?
----------------------------------------------------------------------
List newsList = new ArrayList();
newsList .add(new String("1"));
newsList .add(new String("2")); template = freeerCfg.getTemplate("newslist.ftl");
template.setEncoding("UTF-8");
File htmlFile = new File(request.getRealPath("/")+"/newslist.html");
Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(htmlFile), "UTF-8"));
template.process(newsList, out);
out.flush();
--------------------------------------------------------------------
newslist.ftl文件:
<html>
<head>
<title><title>
</head>
<body>
<#list newsList as being>
<li>${being.title}
</#list>
</body>
</html>
可是报错newsList 未定义!!!!哪里错了?
<#list newsList as being>
<li>${being?default("")}
</#list>
2.该列表没有title这个对应的字段