What would you like to do?
You can use the ReportServlet, that is part of i-net Clear Reports, or you write your own servlet or integrate it in your own servlet.
If you like to write your own servlet or you like to integrate it in your servlet then you need to do the following:
You need to pass all parameters to the engine that you receive from the client (see API of com.inet.report.Engine) and then pass the report back to the client.
The client (report viewer) can be integrated in a Java application or a Java applet on the client side. To do this you need to add the report viewer to your code. The following two examples shows the integration of the report viewer in a Java application and in a Java applet.
This example shows the report viewer in a new window that will be opened after for instance a button is clicked:
… // Create a target window for the viewer Window window = new Dialog(this, "Report Viewer"); window.setSize(Toolkit.getDefaultToolkit().getScreenSize()); window.show(); // Create the Report Viewer SwingReportViewer viewer = new SwingReportViewer(); // Create the connection to the report server URLRenderData myConnection = new URLRenderData(requestString); // Create the report view and set the connection to the report server viewer.addNewReportView(myConnection); // Add the report viewer to the window window.add( BorderLayout.CENTER, viewer); …
After creation of the new window and the report viewer the following values need to be configured:
These values are sent by the report viewer as a request to the report engine (requestString). An example for a request string looks like:
http://<hostname>:<portnumber>/crystal/ReportServlet? report=file:C:/reports/reportfile.rpt&datasource=MySQLServer
To set the requestString you can use a text field or other components (e.g., other text components) to set the report name and the necessary parameters. Another example for setting the report name is to read it from a database where all locations of the reports are saved.
In an applet you can add the Java viewer to a panel (for example).
… // Create the Report Viewer SwingReportViewer viewer = new SwingReportViewer(); // Create the connection to the report server URLRenderData myConnection = new URLRenderData(requestString); // Create the report view and set the connection to the report server viewer.addNewReportView(myConnection); // Add the report viewer to the panel add("Center", viewer); …
After creation of the report viewer the following values need to be configured:
These values are sent by the report viewer as a request to the report engine (requestString). An example for a request string looks like:
http://<hostname>:<portnumber>/crystal/ReportServlet? report=file:C:/reports/reportfile.rpt&datasource=MySQLServer
To set the requestString you can use a text field or other components (e.g., other text components) to set the report name and the necessary parameters. Another example for setting the report name is to read it from a database where all locations of the reports are saved.
If you do not have a servlet in which you can integrate i-net Clear Reports or you don't like to implement your own servlet you can use i-net Clear Reports as a servlet and you only need to request the report in the browser.
In this case you use i-net Clear Reports as a servlet without the integration in your own servlet. To do this follow the steps of the servlet installation.
After you have installed i-net Clear Reports as servlet in your servlet engine you can request reports from a client.
The client (report viewer) can be integrated in a Java application or a Java applet on the client side. To do this you need to add the report viewer to your code. See the section above for two examples that shows the integration of the report viewer in a Java application or in a Java applet.
i-net software strives to provide accurate product documentation. Please give us your feedback using the form below.
NOTE: This form is for documentation feedback only. For technical assistance, please send an email to clearreports@inetsoftware.de.