Birt Integration Part1
Birt Integration Part2
report.js code:
(Note*: After downloading project copy jar from birt runtime lib to /WEB-INF/lib and refactor code as per your need.)
Update :Download below project for pagination support:
Downloads : Birt Example with pagination support
Note* : Purpose of this example is to understand how to integrate Birt engine in code. Please understand and improve as per your need. Do not use directly in production.
Birt Integration Part2
Javascript for loading report using ajax:
report.js is used for loading and downloading report using ajax.Js files are located in /WebContent/js/ which also includes jquery-1.7.1.js.
report.js has two functions:
- generateReport(rptdesignDocName):This loades report in center div.
- downloadReport(format): Download current report in selected format.
report.js code:
/** * This js contains two method * 1)generateReport(reportName) : Requesting to load the report content in div. * 2)downloadReport(format): Downloading the current report in given format. */ //this will hold the currently loaded report name. currentReportName=""; /** * This method is responsible for loading the reports in the report div. * @param localReportName */ function generateReport(reportName) { // here relative url is given if relative url is not working try giving full url var reporturl ="/BirtIntegration/loadReport?ReportName="+reportName+"&ReportFormat=html"; $("#reportData").html("Loading... "); $('#reportData').load(reporturl ,function(response, status, xhr) { if (status == "error") { var msg = "Sorry but there was an error getting details ! "; $("#reportData").html(msg + xhr.status + " " + xhr.statusText); } }); currentReportName=reportName; } /** * Download report function * * @param format */ function downloadReport(format){ if(currentReportName==""){ alert("Please Select the report."); return; } //here relative url is given if relative url is not working try giving full url var reporturl ="/BirtIntegration/loadReport?ReportName="+currentReportName+"&ReportFormat="+format; window.location.href = reporturl; }
Pagination Functionality (Under Development)
The reports can have table which may have many number of rows,In such cases birt provides facility of loading particular page in their api. In a source of example project his part is partly implemented.I currently working one example having pagination in the report.
Download Birt Integration Sample Project
Downloads : BirtIntergration.zip(Note*: After downloading project copy jar from birt runtime lib to /WEB-INF/lib and refactor code as per your need.)
Update :Download below project for pagination support:
Downloads : Birt Example with pagination support
Note* : Purpose of this example is to understand how to integrate Birt engine in code. Please understand and improve as per your need. Do not use directly in production.
Hey Vikram,
ReplyDeleteHave you gotten any further w/ the pagination example?
Check the method processReportDesignDocAndRenderReport() in ReportRenderer class where you can load the requested page.
ReplyDeleteHi Vikram, very nice example.
ReplyDeletethank you very much, it is really the best example in internet, but a question, can you do it without ajax or java script.
ReplyDeletei mean only with servlet......
thank you very much again
Very good example dear i appreciate your effort Vikram .....can you suggest ...I have generated simple report using birt tool.. it is working fine from birt report viewer.. But now I want to run birt report from jsp page. So say any user clicks on hyperlink button, that birt report should be run.
ReplyDeleteAs i am new to BIRT , I don't have any idea about this.. Please help me..Thanks in advance.....
Thanks a lot, its the best example available online, appretiate ur effort !!! :)
ReplyDeleteHow to display charts from birt report using JSP?
ReplyDeleteJust deploy report to the example. Birt report engine will take care of rendering reports.
DeleteI have problem . Error:
ReplyDeletejava.lang.IllegalStateException: Unable to determine the default workspace location. Check your OSGi-less platform configuration of the plugin or datatools workspace path. But i make everything true. Please help me.
Sorry I am not sure about this error. Please mail me details of this error.
DeleteCan you please tell in which class should the parameters be saved in order to run the parameter report?
ReplyDeleteHi, I need to generate report through jsp page. For example, there is a country dropdown in jsp, select any country & submit, generate the BIRT report with data for the selected country in same or another jsp
ReplyDeleteplease give that example if you already done..i want this exactly my task
Deleteunable to download the project
ReplyDeleteDear Vikram,
ReplyDeletei am getting follwing error , can you help me out with it ??
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.spi.IRegistryProvider
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
File is not getting downloaded BirtIntegration.zip
ReplyDeleteThank you so much for publishing this details. This is very helpful for my academic project. i setup the project successfully and now i can change it for my requirement.
ReplyDeletePlease help I'm getting lot of errors:
ReplyDeleteApr 13, 2016 6:36:55 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.Error: Unresolved compilation problem:
The method getEngine() from the type BirtEngineFactory refers to the missing type IReportEngine
at BirtIntegration.BirtViewer.ReportProcessor.initilizeBirtEngine(ReportProcessor.java:29)
at BirtIntegration.Controller.BirtReportController.init(BirtReportController.java:23)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Apr 13, 2016 6:36:55 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet loadReport
java.lang.Error: Unresolved compilation problem:
The method getEngine() from the type BirtEngineFactory refers to the missing type IReportEngine
at BirtIntegration.BirtViewer.ReportProcessor.initilizeBirtEngine(ReportProcessor.java:29)
at BirtIntegration.Controller.BirtReportController.init(BirtReportController.java:23)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
Link for downloading sample project is not available
ReplyDeleteplease sent me the link to my mail
jaymeshiram@gmail.com
Hello Vikram, your example seams to be great, but the links to download are broken.
ReplyDeleteCan you please send me a link or the source to andresbrignoni@hotmail.com ?
thank you!!!!
Hello everyone, did you guys find the working link or were able to download the project?
ReplyDelete