全面超越 Velocity 的全新一代 Java 模板引擎 jetbrick-template 1.2.3 正式版发布。 1. 新增 JDT (Eclipse Java Compiler) 2 | compile.tool = jetbrick.template.compiler.JdkCompiler |
4 | # 使用 Eclipse Java Compiler |
5 | compile.tool = jetbrick.template.compiler.JdtCompiler |
2. 新增自定义全局变量支持
02 | global.variables = sample.GlobalVariables |
05 | public class GlobalVariables implements JetGlobalVariables { |
07 | public Object get(JetContext context, String name) { |
08 | if ("copyright".equals(name)) { |
09 | return "copyright@2000-2010"; |
10 | } else if ("today".equals(name)) { |
12 | } else if ("contextPath".equals(name)) { |
13 | HttpServletRequest request = (HttpServletRequest) context.get(JetWebConfig.REQUEST); |
14 | return request.getContextPath(); |
22 | ${today.format("yyyy-MM-dd")} |
3. 完善支持下面的服务器
Tomcat
Jetty
Resin JBoss/Wildfly Weblogic Glassfish
完善的中文在线文档:http://subchen.github.io/jetbrick-template/ Version 1.2.3 (2014-03-10)
[新增] #82 支持自定义的全局变量 [新增] #83 增加 Eclipse Java Compiler 支持 [修复] #80 WildFly 8.0.0 autoscan/compile error. [修复] #81 resin-3.1.13 compile issue
jetbrick-template 是一个新一代 Java 模板引擎,具有高性能和高扩展性。 适合于动态 HTML 页面输出或者代码生成,可替代 JSP 页面或者 Velocity 等模板。 指令和 Velocity 相似,表达式和 Java 保持一致,易学易用。 
支持类似与 Velocity 的多种指令 支持静态编译 支持编译缓存 支持热加载 支持类型推导 支持泛型 支持可变参数方法调用 支持方法重载 支持类似于 Groovy 的方法扩展 支持函数扩展 支持自定义标签 #tag 支持宏定义 #macro 支持布局 Layout
|