jsp调用ireport乱码,在ireport中pdf浏览没问题,jsp调用出现乱码,没报错!请高人帮助看下!谢谢! 15
部分源码FilereportFile=newFile(application.getRealPath("/resources/report/test.jasper"));...
部分源码 File reportFile = new File(application.getRealPath("/resources/report/test.jasper")); String path=application.getRealPath("/resources/report/");
Map parameters = new HashMap();
parameters.put("F_ID", F_ID);
parameters.put("SUBREPORT_DIR", path+"\\");
try {
oracle.jdbc.OracleConnection conn = null;
final String className = "oracle.jdbc.driver.OracleDriver";
final String localUrl = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";
try{ Class.forName(className);
conn = (OracleConnection) DriverManager.getConnection(localUrl,"test
","1");
}catch (ClassNotFoundException e) { e.printStackTrace();
}catch (SQLException e) {
e.printStackTrace();
}
byte[] bytes =JasperRunManager.runReportToPdf( reportFile.getPath(), parameters, conn); response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream(); 展开
Map parameters = new HashMap();
parameters.put("F_ID", F_ID);
parameters.put("SUBREPORT_DIR", path+"\\");
try {
oracle.jdbc.OracleConnection conn = null;
final String className = "oracle.jdbc.driver.OracleDriver";
final String localUrl = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";
try{ Class.forName(className);
conn = (OracleConnection) DriverManager.getConnection(localUrl,"test
","1");
}catch (ClassNotFoundException e) { e.printStackTrace();
}catch (SQLException e) {
e.printStackTrace();
}
byte[] bytes =JasperRunManager.runReportToPdf( reportFile.getPath(), parameters, conn); response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream(); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询