etmvc+jQuery EasyUI+POI动态导出EXCEL(四)

2014-11-24 11:57:05 · 作者: · 浏览: 71
t.getParameter("searchKey").getBytes("ISO8859-1"), "UTF-8");;
String searchValue=new String(request.getParameter("searchValue").getBytes("ISO8859-1"), "UTF-8");;
//System.out.println("excel1"+searchKey);
//System.out.println("excel2"+searchValue);
String cond = "1=1";
List tmpArgs = new ArrayList();
if (!searchKey.equals("none")) { // 查询条件
cond += " and " + searchKey + " like ";
tmpArgs.add("%" + searchValue + "%");
}
Object[] args = tmpArgs.toArray();
List
dataset = Address.findAll(Address.class, cond, args);
String[] hearders = new String[] {"序号", "企业编号", "企业名称", "所属省市", "详细地址", "邮政编码","优先级",
"登记时间","状态"};//表头数组
ExportExcel
ex = new ExportExcel
();
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String filename = timeFormat.format(new Date())+".xls";
response.setContentType("application/ms-excel;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename="
.concat(String.valueOf(URLEncoder.encode(filename, "UTF-8"))));
OutputStream out = response.getOutputStream();
ex.exportExcel(hearders, dataset, out);
out.close();
//System.out.println("excel导出成功!");
}
这样就实现了Excel的导出,但是感觉跟easyui半毛钱关系都没有,记得以前有看过extjs有相关的前端excel导出的拓展方案,就是不知道easyui,还请各位高手多多指教!