How to Integrate Pentaho (.prpt) Reports with Java Web Application

In our earlier blog, we learned how to do Metadata injection using Pentaho. In today’s article, we’ll learn how to integrate Pentaho (.prpt) reports with a web application.

Typically, to generate reports, it requires working with Pentaho report designer and deploying “.prpt” file onto BI server. But what if we want to use Pentaho reports inside different types of web applications?

This article will serve as a tutorial to integrate your .prpt report with Java web application. You can apply different filters to report and pass parameters from JSP page, to generate the desired reports in different formats.

This article is written based on a real implementation of code and libraries. The only thing you need to consider before starting is to use the same versions of Pentaho SDK, Pentaho Reporting Engine, and Pentaho Report Designer, to avoid any issues related to a data source.

Steps to Integrate a .prpt Report with a Java Application

1. Create “customer.prpt” File from Pentaho Reports Designer with Necessary Requirements.

Pentaho Report

2. Create Dynamic Web Application from Eclipse IDE or Your Choice of Tool, and Put “customer.prpt” Report inside WebContent Folder.

3. Create a JSP Page with Necessary Parameters and Submit the Request to Web Container.

Sample JSP:

try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://190.166.7.11:3306/DB_NAME?user=root&password=root");
Statement statement = connection.createStatement() ;
resultset =statement.executeQuery("SELECT * FROM customers") ;
%>
<center>
<select name="cname">  //parameter name associated with report
<option value="-1"> – Select -</option>
<%  while(resultset.next()){ %>
<option><%= resultset.getString("CUSTOMERNAME")%>
</option>
<% }
}catch(Exception e){
System.out.println("Exception"+e);
}
%>
</select>
</center>
JSP Pentaho Integration

Note: you can pass customer name from a database to find a match in a report. Parameter names in report and JSP page must be same.

4. Set the Parameters into “ReportGeneraterClass” and Fetch the Desired Data Related to Customer Name.

Pentaho report 2

ReportGeneraterClass: A Java class that contains code to read and write a report in different formats.

We hope that the above tutorial would help you to generate the required reports. For more details, please feel free to contact us.

Related Service

Know more about Java development services

Learn more Arrow About Java Development

Want to Hire Skilled Developers?

    Comments

    • Leave a message...

    Ready to Build Your Custom Application Solution?

    Tatvasoft is a reputed CMMI level 3 software and mobile app development company. When it comes to software development companies, Tatvasoft strives to be the best.

    Request a Proposal Arrow Icon
    United States Office
    United States +1 503 832 4034
    17304 Preston Road, Suite 800, Dallas, Texas, 75252 +1 503 832 4034
    United Kingdom Office
    United Kingdom +44 742 409 8452
    307, Euston Road,
    London NW1 3AD,
    United Kingdom
    +44 742 409 8452
    Australia Office
    Australia +61 3 9581 2659
    Level 19/180,
    Lonsdale St, Melbourne
    VIC 3000
    +61 3 9581 2659
    Canada Office
    Canada +1 416 567 7664
    4711 Yonge Street,
    10th Floor, Toronto, Ontario, M2N 6K8
    +1 416 567 7664
    Japan Office
    Japan
    902 Pearl Building,
    Miyamae-cho 8-15, Kawasaki-ku,
    Kawasaki-shi, Kanagawa,
    210-0012
    Saudi Office
    Saudi Arabia +966 552 325 560
    6th Floor,
    Al Budoor Tower Prince Mohammed Bin Fahad Road,
    Dammam 34251
    +966 552 325 560
    India Office
    India +91 960 142 1472
    TatvaSoft House,
    Rajpath Club Road, Ahmedabad, Gujarat,
    380054
    1401-1409, RK Empire,
    150 Feet Ring Road,
    Rajkot, Gujarat,
    360004
    +91 960 142 1472