Pessoal estou gerando meus relatório em HTML, mas o browser não esta interpretando, esta aperecendo as tags HTML,
meu servlet pra gerar o relatório
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
InputStream is = this.getClass().getResourceAsStream("../relatorio/" + request.getParameter("nome") + ".jasper");
ClienteDAO clienteDAO = new ClienteDAO();
Collection<Cliente> clientes = clienteDAO.getClientes(request.getParameter("parametro"));
response.setContentType("text/html; charset=ISO-8859-1");
response.setHeader("Cache-Control", "no-cache");
if (clientes != null || clientes.size() > 0){
GerarRelatorio<Cliente> rel = new GerarRelatorio<Cliente>(clientes , is);
rel.imprimirHTML(response.getWriter(), request.getParameter("title"));
}
else{
response.getWriter().write("<h1>Não há dados");
}
}catch(Exception e){
e.printStackTrace();
}
}
JRHtmlExporter exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, writer);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "images/");
exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, "<html><div><a href=\"#\" onclick=\"javascript:window.print();\"><img src='./images/imprimir.jpg' border='0'></img></a></div><head><title>" + title + "</title></head>");
try {
exporter.exportReport() ;
} catch (JRException e) {
e.printStackTrace();
}
}
olha como esta gerando....
<html><div><a href="#" onclick="javascript:window.print();"><img src='./images/imprimir.jpg' border='0'></img></a></div><head><title>Relat</title></head><a name="JR_PAGE_ANCHOR_0_1"/>
<table style="width: 595px" cellpadding="0" cellspacing="0" border="0" bgcolor="white">
<tr>
<td><img alt="" src="images/px" style="width: 20px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 3px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 36px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 129px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 41px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 23px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 5px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 36px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 73px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 71px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 5px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 36px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 90px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 5px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 2px; height: 1px;"/></td>
<td><img alt="" src="images/px" style="width: 20px; height: 1px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 31px;"/></td>
</tr>
<tr valign="top">
<td colspan="5"><img alt="" src="images/px" style="width: 229px; height: 16px;"/></td>
<td colspan="4" valign="middle" style="text-align: center;"><span style="font-family: Arial; font-size: 12.0px; font-weight: bold;">Relatório de Clientes</span></td>
<td colspan="7"><img alt="" src="images/px" style="width: 229px; height: 16px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 8px;"/></td>
</tr>
<tr valign="top">
<td><img alt="" src="images/px" style="width: 20px; height: 1px;"/></td>
<td colspan="14" style="border-top-style: solid; border-top-width: 1px; border-top-color: #000000; "><img alt="" src="images/px" border="0"/></td>
<td><img alt="" src="images/px" style="width: 20px; height: 1px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 2px;"/></td>
</tr>
<tr valign="top">
<td colspan="2"><img alt="" src="images/px" style="width: 23px; height: 13px;"/></td>
<td><span style="font-family: Arial; font-size: 10.0px; font-weight: bold;">Cliente</span></td>
<td colspan="4"><img alt="" src="images/px" style="width: 198px; height: 13px;"/></td>
<td><span style="font-family: Arial; font-size: 10.0px; font-weight: bold;">Email</span></td>
<td colspan="3"><img alt="" src="images/px" style="width: 149px; height: 13px;"/></td>
<td><span style="font-family: Arial; font-size: 10.0px; font-weight: bold;">Nível</span></td>
<td colspan="4"><img alt="" src="images/px" style="width: 117px; height: 13px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 2px;"/></td>
</tr>
<tr valign="top">
<td colspan="2"><img alt="" src="images/px" style="width: 23px; height: 14px;"/></td>
<td colspan="4"><span style="font-family: Arial; font-size: 10.0px;">0001 - Jose da Silva</span></td>
<td><img alt="" src="images/px" style="width: 5px; height: 14px;"/></td>
<td colspan="3"><span style="font-family: Arial; font-size: 10.0px;">[email removido]</span></td>
<td><img alt="" src="images/px" style="width: 5px; height: 14px;"/></td>
<td colspan="2"><span style="font-family: Arial; font-size: 10.0px;">0001 - Nivel 1</span></td>
<td colspan="3"><img alt="" src="images/px" style="width: 27px; height: 14px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 3px;"/></td>
</tr>
<tr valign="top">
<td colspan="2"><img alt="" src="images/px" style="width: 23px; height: 14px;"/></td>
<td colspan="4"><span style="font-family: Arial; font-size: 10.0px;">0002 - Jose</span></td>
<td><img alt="" src="images/px" style="width: 5px; height: 14px;"/></td>
<td colspan="3"><span style="font-family: Arial; font-size: 10.0px;">[email removido]</span></td>
<td><img alt="" src="images/px" style="width: 5px; height: 14px;"/></td>
<td colspan="2"><span style="font-family: Arial; font-size: 10.0px;">0001 - Nivel 1</span></td>
<td colspan="3"><img alt="" src="images/px" style="width: 27px; height: 14px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 688px;"/></td>
</tr>
<tr valign="top">
<td><img alt="" src="images/px" style="width: 20px; height: 1px;"/></td>
<td colspan="14" style="border-top-style: solid; border-top-width: 1px; border-top-color: #000000; "><img alt="" src="images/px" border="0"/></td>
<td><img alt="" src="images/px" style="width: 20px; height: 1px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 1px;"/></td>
</tr>
<tr valign="top">
<td colspan="2"><img alt="" src="images/px" style="width: 23px; height: 14px;"/></td>
<td colspan="2"><span style="font-family: Arial; font-size: 10.0px;">Emissão: 02/03/2009</span></td>
<td colspan="7"><img alt="" src="images/px" style="width: 254px; height: 14px;"/></td>
<td colspan="3" style="text-align: right;"><span style="font-family: Arial; font-size: 10.0px;">Página: 0001</span></td>
<td colspan="2"><img alt="" src="images/px" style="width: 22px; height: 14px;"/></td>
</tr>
<tr valign="top">
<td colspan="16"><img alt="" src="images/px" style="width: 595px; height: 34px;"/></td>
</tr>
</table>
</td><td width="50%"> </td></tr>
</table>
</body>
</html>