Light-Commons 加入 Template Facade

template 个人认为是web的精髓,如今看来JSP,ASP也都可列为模板范畴,但*SP无疑是失败的,个人观点。

模板+数据=输出,所有模板引擎都是如此,light-commons 试图为流行模板提供统一的接口。目前实现了Freemarker,Commontemplate的Facade.

对于代码开发而言,所需要关心的只有Template,TemplateFactory,剩下的就是了解模板语言。


public interface Template {
String render(Object rootMap);

void render(Object rootMap, Writer writer);
}




public interface TemplateFactory {
Template compile(String name,String source) throws IOException;

Template getTemplate(String location,String encoding) throws Exception;

Template getTemplate(String location,Locale local,String encoding) throws Exception;

Template getTemplate(String name,InputStream inputStream, String encoding) throws IOException;

Template getTemplate(Resource resource, String encoding) throws Exception;

void setResourceLoader(ResourceLoader resourceLoader);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值