jetbrick-template-1.x 旧版文档请看这里:http://subchen.github.io/jetbrick-template/1x/

§Nutz 集成

jetbrick-template 可以和 Nutz 进行集成。

§1. Maven 依赖

<dependency>
    <groupId>com.github.subchen</groupId>
    <artifactId>jetbrick-template-nutz</artifactId>
    <version>2.1.2</version>
</dependency>

§2. web.xml 配置

<context-param>
    <param-name>jetbrick-template-config-location</param-name>
    <param-value>/WEB-INF/jetbrick-template.properties</param-value>
</context-param>

§3. 将视图工厂整合进应用中

在主模块上,加:@Views({JetTemplateViewMaker.class}) 注解

@Views({JetTemplateViewMaker.class})
public class MainModule {

}

§4. Action 中使用 jetx 视图

@At
@Ok("jetx:/WEB-INF/html/user_info.jetx")
public String list(@Param("name") String name, HttpServletRequest request){
    if (name != null) {
        return name;
    }
    return "测试";
}

§5. 模板范例

#define(String obj)
${obj}

§6. 获得输出

测试

§7. 范例源码

具体例子代码参考: https://github.com/subchen/jetbrick-template-2x-samples/