In the previous article, we created our first report with iReport.
Here, we're going to deploy it to the server.
First, we need to connect iReport to the repository. Select JasperServer Repository in the Window menu to show the repository navigator:
Then click on 'Add new server' to create a new server:
Enter a name, and the username and password (for the samples jasperadmin/jasperadmin), and save. If we then click on the server in the repository navigator, we get the following:
With Jasper, you need to define the data sources for a report. For the preview, the local data source is used, but to display the report from the server, you'll need to define one on the server as well.
In the repository explorer, select the Data sources folder, and right click, select Add->Data Source:
Enter a name and a label, and then click on the Data Source Details tab. If you select JDBC data source, you then have the option to 'Import from iReport', where you can select a local data source.
The list of reports in the repository navigator corresponds to the list displayed on the web (see Jasper Reports - Getting Started.)
You can deploy the TABLES report defined in Jasper Reports - Exploring iReport. Now you need to create a Report Unit. A Report Unit is a report plus the data source and any parameters necessary.
We'll create a folder Reports/Test. Then right-click and select Add->Report Unit.
The wizard is displayed. Select a name, label and description:
And the .jrxml file. This is the report1.jrxml containing the report you defined earlier.
And finally a datasource:
And then the report is available from the web site:
And finally, we can display the report:
Next, we'll look at how to update and redeploy a report to the server. Next>>
3 comments:
The best way to deploy or publish a report is using the jdeploy tool on https://sourceforge.net/projects/jaspertools/?source=directory
it allows deal with the datasources problems on the diferent environments, dev, preproduction and production.
Thanks. I'll look at that.
Many thanks for the very useful article!
Post a Comment