Olá pessoal,
Não consigo entender o por quê do meu relatório estar vindo tudo totalmente branco (sem cabeçalho, sem rodapé, sem nada) quando eu
mando gerar pelo sistema, no entanto no iReport ele funciona perfeitamente. Já atualizei as bibliotecas para a versão do meu iReport 4.1.1, mas nada.
O relatório não faz consulta sql, mas contém 5 parametros (nome, cpf, rg, numero e marca). O usuario insere esses valores na view e eles são impressos no relatório.
Este é o HTML:
<form id="formulario" action="<c:url value="/servicos/declaracao"/>" method="GET">
<fieldset>
<legend>Declaração de Aceitação de Serviço de Requalificação de Cilindro</legend>
<br />
<table width="73%" border="0" align="center" cellpadding="8" cellspacing="2">
<td>
<td width="39%" height="30" align="right" class="tabelaFonte">Cliente </td>
<td height="30">
<input name="nome" type="text" size="20" maxlength="10" /></td>
</td>
<td>
<td width="39%" height="30" align="right" class="tabelaFonte">CPF </td>
<td height="30">
<input name="cpf" type="text" size="20" maxlength="10" /></td>
</td>
<td>
<td width="39%" height="30" align="right" class="tabelaFonte">RG </td>
<td height="30">
<input name="rg" type="text" size="20" maxlength="10" /></td>
</td>
<td>
<td width="39%" height="30" align="right" class="tabelaFonte">Número do Cilindro </td>
<td height="30">
<input name="numero" type="text" size="20" maxlength="10" /></td>
</td>
<td>
<td width="39%" height="30" align="right" class="tabelaFonte">Marca </td>
<td height="30">
<input name="marca" type="text" size="20" maxlength="10" /></td>
</td>
<td>
<td height="30"> </td>
<td height="30"><button type="submit">Enviar</button></td>
</td>
</table>
</fieldset>
</form>
Este é o Controller:
@Get
@Path("servicos/declaracao")
public Download declaracao(String nome, String cpf, String rg, String numero, String marca)
throws
JRException,
SQLException, ClassNotFoundException, Exception {
System.out.println("########################################### CONTROLLER "+ nome + " ###########################################################################");
InputStreamDownload relatorio = dao.declaracao(nome, cpf, rg, numero, marca);
return relatorio;
}
Este é o Dao:
public InputStreamDownload declaracao(String nome, String cpf, String rg, String numero, String marca)
throws JRException, SQLException, ClassNotFoundException, Exception {
System.out.println("########################################### DAO "+ nome + " ###########################################################################");
InputStream file = getClass().getClassLoader().
getResourceAsStream("/br/com/sigi/relatorio/declaracao.jasper");
Map parametros = new HashMap();
parametros.put("nome", nome);
parametros.put("cpf", cpf);
parametros.put("rg", rg);
parametros.put("numero", numero);
parametros.put("marca", marca);
ByteArrayOutputStream os = new ByteArrayOutputStream();
JasperRunManager.runReportToPdfStream(file, os, parametros);
InputStream document = new ByteArrayInputStream(os.toByteArray());
return new InputStreamDownload(document, "application/pdf", "Declaracao.pdf", true, os.toByteArray().length);
}