Jump to content

ResourceBundle and Subreports


3rwin

Recommended Posts

Hi,

I have uploaded a main report and a sub report with their resourcebundles to our JasperServer:

root

mainreports

main.jrxml

resourcebundle.properties

subreports

sub.jrxml

resourcebundle.properties

I've created a $R{title} textfield in my sub.jrxml and defined it in the resourcebundle.properties (in the subreports folder), when I run the subreport on the JasperServer it translated my $R{title}, but when I add the subreport to the main and run the main, the $R{title} doesn't translate and gives me a "null" value for the field.

Does anyone have an idea on how to fix this?

 

kind regards,

Erwin

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

I'm not exactly sure what you mean but ... In the subreport I bind the ResourceBundle like this:

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report name" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="ResourceBundle">

So no path ...

 

kind regards,

Erwin

Link to comment
Share on other sites

So the problem is that main report and is subreport have two different resources bundle with the same name... you can:

1)use two different names.

2)use only one resource bundle

3)use the full path: resourceBundle="mainreports/resourcebundle.properties"

Link to comment
Share on other sites

1) if i use ResourceBundle for my main report and ResourceTable for my subreport i get the following error "java.util.MissingResourceException: Can't find bundle for base name ResourceTable, locale en_US". I guess the JasperServer expects to find the ResourceTable of the subreport in the same folder as the main report.

2) I could put the labels of the subreport in the Resourcebundle of the main report, but that would be kinda stupid because everytime I would use the subreport in some other report i would have to write the labels over and over again.

3) i don't know exactly what you mean, when i look at the resourcebundle= statement there is only ResourceBundle (without .properties), what should the path be, keep in mind that i'm working on a JasperServer, should I start at the Root? I've tried a few possibilities but none seem to work.

Thanks for trying to help.

Kind regards,

Erwin

Link to comment
Share on other sites

1-3) Unfortunately I do not know how JasperServer. works I use many reports in a Java Enterprise project, and I can put the resource bundle file in any folder in the classpath. Obviously I correctly referenced in the report.
ResourceBundle = "youFolderInClasspath / yourResourcesFile" without extension, sorry for the mistake.
yourResourcesFile is a java properties file... how do you use it in java code? ;) it must be placed in a classpath folder, as any resources.
 

2) It isn't stupid in advance. Depends on the type of use. I have ten reports and a single resource file, as many labels are common.



Post Edited by cn73 at 17/11/2009 10:11
Link to comment
Share on other sites

1-3) In a Java project I can get this working, but in JasperServer i don't seem to find a solution.

4) I'm trying to re-use a subreport and it's translated labels in several main reports, so I don't want to have to enter the labels of the subreport in every main report.

 

So no solution for the moment ... anyone?

 

Kind regards,

Erwin

Link to comment
Share on other sites

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...