JasperReportsを使用していて、さまざまな言語でレポートを生成したいのですが、問題が発生しました。
そしてこれは私のコードです
public void initQueryReport() throws JRException, ParseException {
try {
Map param = new HashMap();
param.put("DATE", date2);
fill1 = JasperFillManager.fillReport(
"E:\\jasper reports\\employees.jasper", param, connection);
} catch (Exception e) {
System.out.println();
}
}
ServletResponse respnce;
HttpServletResponse respons;
public void PDFQuery(ActionEvent event) throws JRException, IOException, ParseException {
try {
initQueryReport();
respnce = (ServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
respons = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
respons.setContentType("application/pdf");
respons.setHeader("Content-Disposition", "inline");
respons.setContentType("application/pdf");
ServletOutputStream out = respnce.getOutputStream();
JRPdfExporter pdf = new JRPdfExporter();
pdf.setParameter(JRExporterParameter.JASPER_PRINT, fill1);
pdf.setParameter(JRExporterParameter.OUTPUT_STREAM, out);
pdf.exportReport();
} catch (Exception e) {
e.printStackTrace();
}
}
ローカリゼーションdemo.prpertiesという名前のプロパティファイルを作成し、使用する言語で必要なテキストを含め、このファイルをsrc
フォルダーに配置しました。
アプリケーションを実行し、レポートを生成するリンクをクリックすると、次の例外が発生します。
net.sf.jasperreports.engine.JRException: No input source supplied to the exporter
アプリケーションをデバッグモードで実行すると、次の例外の詳細が表示されることに注意してください。
java.util.missingresourceexception can't find bundle for base name locale en_us
この問題を解決するのを手伝ってください。そしてthxたくさん