本文整理匯總了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);
}
}