test2
来源:互联网 发布:欢乐动漫 知乎 编辑:程序博客网 时间:2024/05/24 03:19
/** * 处理模板,并返回字符串流 * * @author l00195395 * @since 2013-8-15 * @param path * @param resource * @param bindItems * @param resourceString * @return * @throws IOException */private String genTemplate(HttpServletResponse httpResponse, String path, Map<String, List<?>> resource, Map<String, Object> bindItems)throws IOException {InputStream resourceStream = null;InputStreamReader streamReader = null;try {resourceStream = this.getClass().getClassLoader().getResourceAsStream(path);streamReader = new InputStreamReader(resourceStream,EncodingUtil.UTF_8);String resourceString = FreeMarkerTemplateUtils.processTemplateIntoString(new Template("", streamReader,new Configuration(), EncodingUtil.UTF_8), bindItems);httpResponse.getWriter().write(resourceString);return resourceString;} catch (TemplateException e) {throw new CommonSystemException("Convert home page error.", e);} finally {StreamUtil.closeStreams(resourceStream, streamReader);}}
/* */ package org.springframework.ui.freemarker;/* */ /* */ import freemarker.template.Template;/* */ import freemarker.template.TemplateException;/* */ import java.io.IOException;/* */ import java.io.StringWriter;/* */ /* */ public abstract class FreeMarkerTemplateUtils/* */ {/* */ public static String processTemplateIntoString(Template template, Object model)/* */ throws IOException, TemplateException/* */ {/* 48 */ StringWriter result = new StringWriter();/* 49 */ template.process(model, result);/* 50 */ return result.toString();/* */ }/* */ }
0 0
- Test2
- test2
- test2
- Test2
- test2
- Test2
- test2
- test2
- test2
- test2
- TEST2
- TEST2
- test2
- test2
- test2
- test2
- test2
- test2
- Hadoop生态上几个技术的关系与区别:hive、pig、hbase 关系与区别
- HDU 4268 Alice and Bob(lower_bound)
- 【hdoj1005】Number Sequence
- Java图形化组件
- C#自己编写定时器
- test2
- js 闭包
- CornerStone commit不成功解决方案
- Linux Shell下的后台运行及其前台的转换 http://mobile.51cto.com/others-446925.htm
- MYSQL 创建用户
- 沈阳微信二维码营销技巧(不得不看)
- 关于定义布局OnMeasure 的总结
- 拆字
- $(window).load(function() {})和$(document).ready(function(){})的区别