本文整理汇总了Java中freemarker.core.Environment.include方法的典型用法代码示例。如果您正苦于以下问题:Java Environment.include方法的具体用法?Java Environment.include怎么用?Java Environment.include使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freemarker.core.Environment
的用法示例。
在下文中一共展示了Environment.include方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: includeTemplate
import freemarker.core.Environment; //导入方法依赖的package包/类
/**
* Includes the template as if Freemarker <code>#include</code> directive had been used,
* without running any context population.
*/
public void includeTemplate(Environment env) throws CmsException {
try {
Template template = getFreeMarkerTemplate();
env.include(template);
} catch (Throwable t) {
throw new CmsException("Error rendering template: " + t.getMessage(), t);
}
}
示例2: includeTemplate
import freemarker.core.Environment; //导入方法依赖的package包/类
/**
* SCIPIO: Includes the given template with the given environment.
* <em>All macro renderer template include calls must be wrapped with this method!
* See {@link #getCurrentEnvironment}.</em>
*
* @see #getCurrentEnvironment
*/
public static void includeTemplate(Template template, Environment env) throws TemplateException, IOException {
Environment savedEnv = threadEnv.get();
threadEnv.set(env);
try {
env.include(template);
}
finally {
threadEnv.set(savedEnv);
}
}