将Jasper报表服务器中的Jasper报表集成到web应用程序中



我试图在JSF web应用程序上显示来自Jasper Report Server的Jasper报表,但是我找不到描述如何实现它的任何文档或资源。我目前在我的项目中使用Jasper报表,但我计划将报表移动到Jasper报表服务器以获得更好的性能和维护,并使用任何适配器或库从Jasper报表服务器访问报表。

解决方案1:

我回答是为了帮助任何人寻找类似的问题。

我能够使用jrs-rest-client集成JR服务器。下面是我的示例代码

RestClientConfiguration configuration = new RestClientConfiguration("http://localhost:8080/jasperserver");
JasperserverRestClient client = new JasperserverRestClient(configuration);
Session session = client.authenticate("user", "password");
OperationResult<InputStream> result = session
.reportingService()
.report("/E_Reports/myReport")
.prepareForRun(ReportOutputFormat.PDF, 1)
.parameter("param", "702558")
.run();
InputStream report = result.getEntity();

解决方案2:

还有另一个解决方案。我在这个链接上找到了。

https://community.jaspersoft.com/questions/815042/run-report-using-restv2-and-java

最新更新