[RESOLVIDO]IReport Exportar para Html

Pessoal fiz a rotina abaixo, porem ele nao mostra no browser o relatorio e nem da erro no servidor.

Obs. com o JASPER , abre normal o relatorio .

        FacesContext context = FacesContext.getCurrentInstance();
        HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();    
        InputStream reportStream = context.getExternalContext()
        .getResourceAsStream("/relatorios/guiaservico.jasper");
        


      HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();      
      PrintWriter printWriter = response.getWriter(); 
      
      
         JRHtmlExporter htmlExporter = new JRHtmlExporter();  
  
            response.setContentType("text/html");  
  
            response.setCharacterEncoding("ISO-8859-1");  
  
            request.getSession().setAttribute(  
                    ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,  
                    jp);  
            htmlExporter.setParameter(JRExporterParameter.JASPER_PRINT,  
                    jp);  
            htmlExporter.setParameter(JRExporterParameter.OUTPUT_WRITER,  
                    printWriter);  
            htmlExporter.setParameter(JRExporterParameter.CHARACTER_ENCODING,  
                    "ISO-8859-1");  
            /* 
             * aqui é mapeado para o servlet do JasperReport, para que ao gerar o  
             * html não renderize as imagens em branco, pois os espaços em branco, 
             * são imagens em branco que ele adiciona! 
             * Basta adicionar no web.xml a chamada ao servlet que existe no pacote: 
             *     
                <servlet> 
                  <servlet-name>ImageServlet</servlet-name> 
                  <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class> 
               </servlet>  
             
               <servlet-mapping> 
                  <servlet-name>ImageServlet</servlet-name> 
                  <url-pattern>/image.servlet</url-pattern> 
               </servlet-mapping> 
              *   
             */  
            htmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,  
                    request.getContextPath() + "/image.servlet?image=");  
            htmlExporter.exportReport();        



O que aparece no navegador? Tela em branco?

entao o estranho que nao aparece nada. …fiz um botao para imprimir este relatorio, e ele permanece neste botao…e não da sinal de vida.

tentei fazer dessa forma , mas nao acontece nada :

        JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream,map,fonteDados);
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        if (jasperPrint == null) {
            //throw new ReportingException("jasperPrint null, can't convert to HTML report");
            System.out.print("teste");
        }
        try {
            JRHtmlExporter jrHtmlExporter = new JRHtmlExporter();
            jrHtmlExporter.setParameter(JRHtmlExporterParameter.JASPER_PRINT, jasperPrint);
            jrHtmlExporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, true);
            // To generate a HTML report we want configure ImageServlet in component.xml file of reporting UI bundle
            // Then want to set the  IMAGES_URI parameter
            jrHtmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "../servlets/image?image=");
            //  remove empty spaces
            jrHtmlExporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
            jrHtmlExporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.TRUE);
            jrHtmlExporter.setParameter(JRHtmlExporterParameter.OUTPUT_STREAM, outputStream);
            jrHtmlExporter.exportReport();

        } catch (JRException e) {
            throw new JRException("Error occurred exporting HTML report ", e);
        }


Resolvi abrir em pdf

  byte[]bytes  = JasperRunManager.runReportToPdf(reportStream, map,  
                            fonteDados);  
        
                response.setContentLength(bytes.length);  
                ServletOutputStream servletStream = response.getOutputStream();  
                servletStream.write(bytes, 0, bytes.length);  
                servletStream.flush();  
                servletStream.close();  
                FacesContext.getCurrentInstance().responseComplete();