Directing HTML reports to a browser

In previous chapters, we have seen the examples of generating a PDF report and streaming it to the browser "on the fly". Earlier in this chapter, we saw how to export reports to an HTML and store them in the filesystem. In this section, we will see how to export a report to HTML and immediately send it to the user's browser window. The following example is a servlet that exports an already filled JasperPrint object to HTML and displays the resulting exported report into the browser. As can be seen in the following code, it takes the base report name as a request parameter. Executing this report using the BarChartDemoReport from Chapter 7, Adding Charts and Graphics to Reports, results in the following page being ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.