<dependency> <groupId>org.codecop</groupId> <artifactId>snippetory</artifactId> <version>1.3.0</version> </dependency> Template template = TemplateName.ofClasspath(MyClass.class, "template.html"); template.get().set("propertyName", "propertyValue"); String renderedText = template.toString(); html <!--#var list = ["item1", "item2", "item3"]--> <!--#foreach (item in list)--> <!--#if (item.equals("item2"))--> <li class="selected">${item}</li> <!--#else--> <li>${item}</li> <!--#endif--> <!--#end--> template.registerFunction("functionName", (context, arguments) -> { }); template.registerFilter("filterName", (input) -> { }); <!--#var result = functionName("argument")-->


上一篇:
下一篇:
切换中文