update
This commit is contained in:
parent
84b1ec308a
commit
8d22786e3f
|
|
@ -35,14 +35,14 @@ public abstract class BeetlMaker {
|
||||||
* 生成静态html
|
* 生成静态html
|
||||||
*
|
*
|
||||||
* @param ftlPath 模板路径
|
* @param ftlPath 模板路径
|
||||||
* @param paramMap 参数
|
* @param paras 参数
|
||||||
* @param htmlPath html文件保存路径
|
* @param htmlPath html文件保存路径
|
||||||
*/
|
*/
|
||||||
public static void makeHtml(String tlPath, Map<String, Object> paramMap, String htmlPath) {
|
public static void makeHtml(String tlPath, Map<String, Object> paras, String htmlPath) {
|
||||||
PrintWriter pw = null;
|
PrintWriter pw = null;
|
||||||
try {
|
try {
|
||||||
pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(htmlPath), "UTF-8"));
|
pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(htmlPath), "UTF-8"));
|
||||||
BeetlTemplate.buildTo(FileKit.readString(tlPath, "UTF-8"), paramMap, pw);
|
BeetlTemplate.buildTo(FileKit.readString(tlPath, "UTF-8"), paras, pw);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import com.smallchill.core.beetl.tag.SelectTag;
|
||||||
import com.smallchill.core.beetl.tag.SideBarTag;
|
import com.smallchill.core.beetl.tag.SideBarTag;
|
||||||
import com.smallchill.core.constant.ConstConfig;
|
import com.smallchill.core.constant.ConstConfig;
|
||||||
import com.smallchill.core.constant.Cst;
|
import com.smallchill.core.constant.Cst;
|
||||||
|
import com.smallchill.core.toolbox.Paras;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Beetl模板绑值
|
* @title Beetl模板绑值
|
||||||
|
|
@ -80,26 +81,26 @@ public class BeetlTemplate {
|
||||||
groupTemplate.registerFunctionPackage("shiro", new ShiroExt());
|
groupTemplate.registerFunctionPackage("shiro", new ShiroExt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String build(String sql, Map<String, Object> param) {
|
public static String build(String str, Map<String, Object> paras) {
|
||||||
Template t = gt.getTemplate(sql);
|
Template t = gt.getTemplate(str);
|
||||||
if (null == param) {
|
if (null == paras) {
|
||||||
param = new HashMap<String, Object>();
|
paras = Paras.create();
|
||||||
}
|
}
|
||||||
param.put("ctxPath", Cst.me().getContextPath());
|
paras.put("ctxPath", Cst.me().getContextPath());
|
||||||
for (String o : param.keySet()) {
|
for (String o : paras.keySet()) {
|
||||||
t.binding(o, param.get(o));
|
t.binding(o, paras.get(o));
|
||||||
}
|
}
|
||||||
return t.render();
|
return t.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void buildTo(String sql, Map<String, Object> param, PrintWriter pw) {
|
public static void buildTo(String str, Map<String, Object> paras, PrintWriter pw) {
|
||||||
Template t = gt.getTemplate(sql);
|
Template t = gt.getTemplate(str);
|
||||||
if (null == param) {
|
if (null == paras) {
|
||||||
param = new HashMap<String, Object>();
|
paras = Paras.create();
|
||||||
}
|
}
|
||||||
param.put("ctxPath", Cst.me().getContextPath());
|
paras.put("ctxPath", Cst.me().getContextPath());
|
||||||
for (String o : param.keySet()) {
|
for (String o : paras.keySet()) {
|
||||||
t.binding(o, param.get(o));
|
t.binding(o, paras.get(o));
|
||||||
}
|
}
|
||||||
t.renderTo(pw);
|
t.renderTo(pw);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user