@SuppressWarnings("static-access") public String downloadReport() { String type = getParaValue("type"); CompReportHelper helper = new CompReportHelper(); Hashtable allData = helper.getAllDevice(); Vector vector = null; List deviceList = new ArrayList(); String file = ""; // 保存到项目文件夹下的指定文件夹 String filePath = ""; // 获取系统文件夹路径 if (allData != null) { if (allData.containsKey("deviceVec")) { vector = (Vector) allData.get("deviceVec"); helper.createPie(vector); } if (allData.containsKey("deviceList")) { deviceList = (List) allData.get("deviceList"); if (type.equals("doc")) { file = "/temp/allDevice.doc"; filePath = ResourceCenter.getInstance().getSysPath() + file; try { helper.createDoc(vector, deviceList, filePath); } catch (DocumentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else if (type.equals("xls")) { file = "/temp/allDevice.xls"; filePath = ResourceCenter.getInstance().getSysPath() + file; try { helper.createExcel(vector, deviceList, filePath); } catch (WriteException e) { e.printStackTrace(); } } else if (type.equals("pdf")) { file = "/temp/allDevice.pdf"; filePath = ResourceCenter.getInstance().getSysPath() + file; try { helper.createPdf(vector, deviceList, filePath); } catch (DocumentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } request.setAttribute("filename", filePath); return "/capreport/net/download.jsp"; }
public String allDeviceReport() { CompReportHelper helper = new CompReportHelper(); Hashtable allData = helper.getAllDevice(); request.setAttribute("allData", allData); return "/config/vpntelnet/compliance/allDeviceReport.jsp"; }