日期:2014-05-17  浏览次数:20638 次

关于include的问题非用一项目 紧急!!!!!!!!!!!高手帮忙
是这样的现在新开了一个项目是SSH的
页面用的freemarker
现在想在页面include另外一个项目的静态页面
怎么办

------解决方案--------------------
生成前写在模板里不行吗?
------解决方案--------------------
不明白你的意思,freemarker本来就有includer指令啊。
<#include filename>或者<#include filenameoptions>

filename: 表达式转换为字符串
options: encoding=encoding, parse=parse encoding: 表达式转换为字符串
parse: 表达式转换为逻辑值,是否作为ftl文件解析。

<#include "/common/navbar.html" parse=false encoding="Shift_JIS">

<#include "*/footer.ftl">表示当前目录下以及所有父目录下的文件。如果当前模在/foo/bar/template.ftl ,那么查找footer.ftl的顺序为:/foo/bar/footer.ftl
/foo/footer.ftl/footer.ftl这种方式讲允许设计者将通用的模版放在父文件夹里面。
也可以只指定部分路径:<#include "*/commons/footer.ftl">