Empty Datasources
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.
<?xml version="1.0"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="EmptyDataSourceReport"> <detail> <band height="20"> <staticText> <reportElement x="20" y="0" width="200" height="20"/> <text><! [CDATA[This simple report...