-1
Normally we generate report by Ireports based on database query, only now I come across the following question, I will assemble a report based on the data shown in the customer’s look, in case it is redundant to fetch the information again in the bank.
I did a simple test passing 1 information via parameter and trying to generate a view.
But it did not generate any page, I believe it is something simple but I am not able to generate this output.
In the report I only have one parameter created and added in the detail field in it.
And as soon as I make his call.
public void ImpressaoRelatorio() {
InputStream inputStream = getClass().getResourceAsStream("RelatorioParametro.jasper");
Map<String, Object> parametros = new HashMap<String, Object>();
parametros.put("descProduto", "Produto Teste");
try {
ReportUtils.openReport("Relatorio Produto teste", inputStream, parametros,
ConnectionFactory.getAgilConnection());
} catch (SQLException exc) {
exc.printStackTrace();
} catch (JRException exc) {
exc.printStackTrace();
}
}
But when executing it returns blank.
Are you passing at least one element in the Collection of your datasource? Something like: Jrbeancollectiondatasource ds = new Jrbeancollectiondatasource(collectionComUmaInstance); ... Jasperprint prt = Jasperfillmanager.fillReport(getClass(). getResourceAsStream("/" + wayRelatory), parameters, ds);
– Orlando Correa