JSPT - JSP 扩展


Apache
跨平台
Java

软件简介

JSPT 是一个包装了 Tomcat jaspr API 的类库。解决了JSP不能用作邮件、短信等模板的问题。

代码示例:

File templateDir = new File("/com/ninephoenix/jspt");
String javaPkgName = "com.ninephoenix.jspt";
JsptEngine.init(templateDir, javaPkgName);
Map<String, Object> model = new HashMap<String, Object>();
model.put("name", "world");
String template = "/renderTest.jsp";
StringWriter out = new StringWriter();
JsptEngine.render(template, model, out);
Assert.assertEquals(out.toString(), "Hello world!");