Open topic with navigation
Uploading Undetected File Resources
The JasperReport wizard can’t detect every type of resource referenced in the main JRXML. You need to add the undetected resources; so the server can validate the report. For the following example we provide the names of these resources. To discover undetected resources open the JRXML in Jaspersoft Studio and examine its parameters and properties. For more information about the JasperReports Server Plug-in, see the Jaspersoft Studio User Guide.
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 Jaspersoft Studio uses for the resource ID.
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 the file name scriptlet.jar, indicating that the server successfully loaded and automatically detected the JAR.
|
d.
|
Enter the following information: |
|
•
|
Resource ID– Scriptlet. 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.
|
3.
|
Add and upload the English resource bundle: |
|
a.
|
On the Controls & Resources page, click Add Resource. 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, and select it. 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. |
|
b.
|
Select Upload a Local File, click Browse to locate the file <js-install>/samples/resource_bundles/sales_ro.properties, and select it. |
|
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 |
|
e.
|
Click Next. 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 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. |
Open topic with navigation