The JasperReport wizard can’t detect every type of resource referenced in the main JRXML. You need to know the names of these resources and add them to the report; otherwise, the server can’t validate the report. This document provides you with the names of these resources, but if you wanted to discover these names, use the JasperReports Server Plug-in to open the JRXML in iReport and examine its parameters and properties. For more information about the JasperReports Server Plug-in, see Accessing Reports and Domains from iReport.
These are the undetected resources in the SalesByMonth.jrxml:
|
•
|
A scriptlet JAR – The scriptlet writes the message, “I’m a scriptlet in a jar,” to the last page of the report output. |
|
•
|
An English language resource bundle. |
|
•
|
The optional Romanian language resource bundle. |
If you’re interested in working with a multi-lingual report, add the Romanian resource bundle. The Romanian resource bundle is part of the sample data installed with the server.
On the Controls & Resources page, upload the undetected resources to the server using exactly the same name for the resource ID as iReport uses.
To upload the undetected file resources for the complex report example:
|
1.
|
Add and upload the scriptlet JAR file: |
|
a.
|
On the Controls & Resources page, click Add Resource. |
|
b.
|
On the Locate File Resource page, select Upload a Local File, and click Browse to locate the <js-install>/samples/jars/scriptlet.jar file. Select scriptlet.jar. |
The path to the file appears in the Upload a Local file field.
The Add a Report Resource page appears. Scriptlet JAR Resource Properties shows that the file name scriptlet.jar appears, indicating that the server successfully loaded and automatically detected the JAR.
|
d.
|
Enter the following information; the Resource ID is referenced in the main JRXML file, so do not change it: |
|
•
|
Description – Scriptlet JAR for complex report |
Scriptlet JAR Resource Properties shows these values entered on the Add a Report Resource page.
2.Click Next.
|
3.
|
Add and upload the English resource bundle: |
|
a.
|
On the Controls & Resources page, click Add Resource again. |
The Locate File Resource page appears.
|
b.
|
Select Upload a Local File, click Browse to locate the file <js-install>/samples/resource_bundles/sales.properties. Select the file. |
The path to the resource bundle appears in the Upload a Local file field.
|
c.
|
In Locate File Resource, click Next. |
The Add a Report Resource page indicates that the file was successfully loaded and automatically detected as a resource bundle.
|
d.
|
Enter the following information: |
|
•
|
Name – sales.properties |
|
•
|
Resource ID – sales.properties |
|
•
|
Description – Default English resource bundle |
|
5.
|
Add and upload the Romanian Resource bundle: |
|
a.
|
On the Controls & Resources page, click Add Resource again. |
|
b.
|
Select Upload a Local File and click Browse to locate this file: |
<js-install>/samples/resource_bundles/sales_ro.properties
|
c.
|
In Locate File Resource, click Next. |
The Add a Report Resource page shows that uploading the file was successful. The server recognized the type (resource bundle) and name (sales_ro.properties) of the selected resource.
|
d.
|
Enter the following information: |
|
•
|
Name – sales_ro.properties |
|
•
|
Resource ID – sales_ro.properties |
|
•
|
Description – Romanian resource bundle |
Controls & Resources lists all the files:
If you want to upload a different file for a named resource, click its resource ID in the Resources list and locate the new file or repository object. You can also change the name and description of the resource, but not its resource ID. If there’s a mistake in a resource ID:
|
•
|
Locate the ID in the list of resources on the Controls & Resources page, and click Remove. |
|
•
|
Re-add the resource, entering the correct resource ID. |