halil
2015-05-20 14:15:16 UTC
Hi All,
I am developing a web application based on OSGI. I have templates on
different bundles and want to produce a html code by merging differnt ftl
files which are on different bundles. I need this scenario because I need
versioned templates...
I am expecting to find JAVA API Documentation but could not find. I want to
implement programmatically which is done as below with Freemarker template
language.
<#macro myLayout>
<html>
<body style="width:100%;height:100%">
<table border="1" cellspacing="0" cellpadding="0" style=
"width:100%;height:100%">
<tr>
<td colspan="2">
<#include "header.ftl"/>
</td>
</tr>
<tr>
<td>
<#include "menu.ftl"/>
</td>
<td>
<#nested/>
</td>
</tr>
<tr>
<td colspan="2">
<#include "footer.ftl"/>
</td>
</tr>
</table>
</body>
</html>
</#macro>
I need such hypothetical java api which does above templating.
Freemarker.macro("mylayout.ftl")
.include(1,"header.ftl")
.include(2,"menu.ftl")
.include(3,"footer.ftl")
.process(FileUtils.read("nested.ftl"));
I see that Freemarker include directive refers to the files, meanly it is
file system based. I could not find a documentation which helps me do it
programmatically as above...
I am on a wrong way? or I missed something in the understanding of
Freemarker architecture? I don't know...
Could you please help me on this issue?
thanks in advance,
-halil.
I am developing a web application based on OSGI. I have templates on
different bundles and want to produce a html code by merging differnt ftl
files which are on different bundles. I need this scenario because I need
versioned templates...
I am expecting to find JAVA API Documentation but could not find. I want to
implement programmatically which is done as below with Freemarker template
language.
<#macro myLayout>
<html>
<body style="width:100%;height:100%">
<table border="1" cellspacing="0" cellpadding="0" style=
"width:100%;height:100%">
<tr>
<td colspan="2">
<#include "header.ftl"/>
</td>
</tr>
<tr>
<td>
<#include "menu.ftl"/>
</td>
<td>
<#nested/>
</td>
</tr>
<tr>
<td colspan="2">
<#include "footer.ftl"/>
</td>
</tr>
</table>
</body>
</html>
</#macro>
I need such hypothetical java api which does above templating.
Freemarker.macro("mylayout.ftl")
.include(1,"header.ftl")
.include(2,"menu.ftl")
.include(3,"footer.ftl")
.process(FileUtils.read("nested.ftl"));
I see that Freemarker include directive refers to the files, meanly it is
file system based. I could not find a documentation which helps me do it
programmatically as above...
I am on a wrong way? or I missed something in the understanding of
Freemarker architecture? I don't know...
Could you please help me on this issue?
thanks in advance,
-halil.