use of org.beetl.core.Configuration in project beetl2.0 by javamonkey.
the class ClasspathRL method main.
public static void main(String[] args) throws Exception {
ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader();
URL url = resourceLoader.getClass().getResource("/org/beetl/sample/s01/hello.txt");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate("/org/beetl/sample/s01/hello.txt");
String str = t.render();
System.out.println(str);
}
use of org.beetl.core.Configuration in project beetl2.0 by javamonkey.
the class FilePathRL method main.
public static void main(String[] args) throws Exception {
String root = System.getProperty("user.dir") + File.separator + "template";
FileResourceLoader resourceLoader = new FileResourceLoader(root, "utf-8");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate("/s01/hello.txt");
String str = t.render();
System.out.println(str);
}
use of org.beetl.core.Configuration in project beetl2.0 by javamonkey.
the class HelloBeetl method main.
public static void main(String[] args) throws Exception {
StringTemplateResourceLoader resourceLoader = new StringTemplateResourceLoader();
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate("hello,${name}");
t.binding("name", "beetl");
String str = t.render();
System.out.println(str);
}
use of org.beetl.core.Configuration in project beetl2.0 by javamonkey.
the class SharedVars method main.
public static void main(String[] args) throws Exception {
ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader();
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Map<String, Object> shared = new HashMap<String, Object>();
shared.put("name", "beetl");
gt.setSharedVars(shared);
Template t = gt.getTemplate("/org/beetl/sample/s0208/t1.txt");
String str = t.render();
System.out.println(str);
t = gt.getTemplate("/org/beetl/sample/s0208/t2.txt");
str = t.render();
System.out.println(str);
}
use of org.beetl.core.Configuration in project beetl2.0 by javamonkey.
the class RegisterFunctionByFile method main.
public static void main(String[] args) throws Exception {
String root = System.getProperty("user.dir") + File.separator + "template";
FileResourceLoader resourceLoader = new FileResourceLoader(root, "utf-8");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
gt.registerFunctionPackage("t", new FunctionPackage());
Template t = gt.getTemplate("/s32/functionPackage.html");
String str = t.render();
System.out.println(str);
}
Aggregations