Jump to content

REPORT_RESOURCE_BUNDLE null when using JasperPrint


hovendal

Recommended Posts

 Dear all,

I have run into a problem, which I cant seem to figure out.

We have a running application, with a lot of reports, which are all working fine. We are using spring and XmlViewResolver to catch report views as pdf, xml etc, and just returning a modeandview. This all works like a charm,

However, a request for the ability to store a compiled pdf report as binary data in a database has seen the light. Therefore, we added support for this by instead of returning a view, we compiled the report with JasperPrint. Se code below for specific details.

However, the generated print is without localizations. All ressource bundle fields, like:
<![CDATA[$P{REPORT_RESOURCE_BUNDLE}.getString("insta.report.profiles.title")]]>
 returns null. 

How can this be, and what are we doing wrong? As said many times, if were are returning a view istead, this works just fine.

Hope somebody is able to help.

 

Code:
// Setup model adn JRBeanCollectionDatasourceMap<Object, Object> model = new HashMap<Object, Object>(0);List<ProfilesBean> datasource = new ArrayList<ProfilesBean>(0);datasource.add(profilesBean);model.put("data", datasource);model.put("format", "pdf");JRBeanCollectionDataSource source = new JRBeanCollectionDataSource(datasource);// Compile reportJasperPrint jp = JasperFillManager.fillReport("C:/reports/profilesReport.jasper", model, source);// Create binary file and saveBinaryFile file = new BinaryFile(JasperExportManager.exportReportToPdf(jp));this.fileService.saveBinaryFile(file);
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...