JasperFillManager.fillReportToFile() : The JasperFillManager.
fillReportToFile() method creates a report and stores it in the file system
as a JRprint file, JasperReports' native report format.
JasperFillmanager.fillReportToStream() : The JasperFillManager.
fillReportToStream() method generates a report and streams it through a
Each of these methods takes an instance of a net.sf.jasperreports.engine.
JRDataSource object as one of its arguments, or an instance of java.sql.Connection
to connect directly to the database. In the previous chapter, we saw how we can pass
either a connection object or an instance of JRResultSetDataSource to a report
template to generate a report from database data. Report templates don't need to
change at all if we decide to change the type of datasource we will use to populate
them. For most examples in this chapter, we will use a slightly modified version of
the report template we used in the previous chapter, populating it with different
types of datasources. As a matter of fact, the only example that will not use the
template from the previous chapter is the one illustrating empty datasources, which
we discuss next.
The first type of datasource we will discuss in this chapter is empty datasources.
There is no way to create a report without using either a database connection or a
datasource. If we need to create simple reports that require no external datasources,
we can use an empty datasource to accomplish this. JasperReports provides the
net.sf.jasperreports.engine.JREmptyDataSource class that we can use for
these situations. Let us create a simple report template containing only static data to
illustrate this process.
PUBLIC "-//JasperReports//DTD Report Design//EN"
<reportElement x="20" y="0" width="200" height="20"/>
<text><![CDATA[This simple report contains only static