We start our example by creating a static replet. To make running the examples easy, we do not use a database, but get data from a delimited data file.
package inetsoft.demo.replets; import inetsoft.sree.*; import inetsoft.report.*; import inetsoft.report.io.*; import inetsoft.report.lens.*; import java.io.*; public class Replet1 extends BasicReplet { public void init(RepletRequest req) throws RepletException { try { // load the report template InputStream input = getClass(). getResourceAsStream("embeddedtable.srt"); Builder builder = Builder.getBuilder(Builder.TEMPLATE, input); report = (ReportSheet) builder.read("."); // load data from data file InputStream input2 = getClass().getResourceAsStream("data/" + "education.csv"); ttl = new TextTableLens(input2,","); ttl.setHeaderRowCount(1); } catch(Exception e) { e.printStackTrace(); throw new RepletException(e.getMessage()); } } public ReportSheet createReport(RepletRequest req) { // set the data on the template report.setElement("Table1", ttl); return report; } ReportSheet report; TextTableLens ttl; }
To use the Web Viewer to view the replet, we need to deploy the servlet version of the repository in the application server of your choice. The deployment of a servlet may differ between different servlet engines.
The Application Server needs to have a webapp with the appropriate InetSoft JARs, and a registered servlet.
The init argument specifies the location of the configuration files. Usually the 'classes' directory of the webapp. The ServletRepository needs to be identified as follows:
MAPPING Examples (the name used in the url)
Class Name inetsoft.sree.web.ServletRepository
Init Arguments sree.home=c:/Tomcat/webapps/sree/WEB-INF/classes
The servlet and reports can be deployed directly from the Enterprise Manager in supported servers, or deployed manually following application server instructions.
After the servlet is properly setup, we can start a browser and point it to our servlet, for example URL: http://localhost:8080/sree/Reports.
When the URL is accessed, it shows a hierarchical view of the repository contents. Select a replet on the tree. The viewer window for that report comes up on the main window frame.
The viewer window shows one page at a time. It has navigation buttons to move to other pages of a report. We cover the details of the Web Viewer in the End User.
Copyright © 2023, InetSoft Technology Corp.