【发布时间】:2018-03-16 17:38:31
【问题描述】:
我想在我的 java 代码中获取我的模板中定义的所有自定义参数。 示例
<pre><code><html><head><style>td {
font-family: monospace;
font-size: 12px;
}</style></head><body>
<table width="16%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td colspan="5" align="center">${test1}</td>
</tr>
<tr>
<td colspan="5" align="center">${test2}</td>
</tr>
</table>
</body></html></code></pre>
我想要在我的 java 代码中获取 test1 和 test2 参数。所以我想要下面的东西
Template template = this.getTemplate(ftl);
// a, should have test1, test2 and in case template any other template then it should get parameters for that too
String[] a= template.getAttributes();
【问题讨论】:
标签: java freemarker