前提・実現したいこと
jasperstudioで作成した帳票を.jspを使って、pdfの作成、指定したパスへ保存する機能を実装しています。
jasperstudio内の「source」にて「groupExpression」で指定したパラメータが変わるごとに、分割して保存したいです。
発生している問題・エラーメッセージ
レポート出力、および1つのpdfとして保存することはうまくいっていますが、
groupExpressionで指定したパラメータが変わるごとに保存する機能の実装が分からないです。
該当のソースコード
<%
Connection conn = null;
try { //Connecting to the MySQL database Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("接続先"); //Loading Jasper Report File from Local file system String jrxmlFile = session.getServletContext().getRealPath("パス先.jrxml"); InputStream input = new FileInputStream(new File(jrxmlFile)); //Generating the report JasperReport jasperReport = JasperCompileManager.compileReport(input); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
//Saving the report as a Pdf
String realPath = getServletContext().getRealPath("パス先");
File file = new File(realPath);
file.mkdirs();
JasperExportManager.exportReportToPdfFile(jasperPrint,file.getAbsolutePath()+"/"+groupExpressionに指定しているパラメータ+".pdf");
//Exporting the report as a PDF JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); response.getOutputStream().flush(); response.getOutputStream().close(); } catch (Exception e) { e.printStackTrace(); } finally { if (conn != null) { conn.close(); } }
%>
補足情報
接続先やパス名など、お見せ出来ないものは「接続先」「パス先」などと表示させていただいております。
ご了承ください。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。