freeer模板中能否嵌入模板?就好象jsp页面中能嵌入另外一个jsp一样?
解决方案 »
- struts2 标签中添加动态变量的问题.请教高手~~~~~~~~~已经弄了很久了~~~~~~~~~~~~~~
- Hibernate 批量处理语句
- The absolute uri: http://struts.apache.org/tags-html cannot be resolved in either web.xml or the jar files deployed with this ap
- Axis做WS开发,如何使用代理?
- 高分求soap包解析,在线急等!!急急急急急!!!!300分(解决了另开贴加分)
- 用过tanghan插件设置数据库的朋友请进来一看,一事相求,多谢!!
- 如何学习java类库,给些好的建议啊
- 急:web services 调用能带word文档吗?
- ejb的事务处理
- shiro登录页面 显示404
- 这个正则表达式怎么写
- java 获取日期问题
大家好:我是${name},今年${age}岁.<#nested>
</#macro>
-------------------------
template.ftl
<#import "/src/macro/myTemplate.ftl" as my/>
<@my.student name="樊海" age="25">
123
</@my.student>
public class FreeMarkerTest { public static void main(String[] args) throws Exception {
UpperDirective upper = new UpperDirective();
Map map = new HashMap();
map.put("upper", upper);
Template template = FreeMarkerUtil.getTemplate("src\\macro\\template.ftl");
File htmlFile = new File("src\\macro\\freemaker.htm");
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFile)));
template.process(map, writer);
}
}
<#include "/csdn/templete.ftl">
在一个ftl中直接写上面的这个标签就会把templete.ftl包含进来,但是如果templete.ftl模板中需要属性值,我怎么带过来啊?是说在业务逻辑层把两个页面的参数都带过来?那样业务逻辑层启不是很乱