public void test(){
Configuration cfg = new Configuration();
cfg.setClassForTemplateLoading(getClass() , "");
cfg.setObjectWrapper(new DefaultObjectWrapper());
Map<String, Object> goods = new HashMap<String, Object>();
// goods.put("name", "kingapex");
List list= new ArrayList();
list.add("1");
list.add("2");
list.add("3");
goods.put("nlist", list);
try {
Template temp = cfg.getTemplate("goodslist.html");
ByteOutputStream stream = new ByteOutputStream();
Writer out = new OutputStreamWriter(stream);
temp.process(goods, out);
out.flush();
String name =this.getClass().getName();
name = name.substring(name.lastIndexOf('.')+1);
} catch (IOException e) {
e.printStackTrace();
} catch (TemplateException e) {
e.printStackTrace();
}
}