Nelis Posted February 8, 2007 Share Posted February 8, 2007 Hi everyone¡¡¡I need to deploy my reports in html format to the client, i wrote a code to do that but this only create the html report in C:/, but it doesn't deploy in the client's side...My code is like this:Code: public void Servicios () {callProcGrabaLog("RptServicios", "REPORT", "", "", ""«»);PreparedStatement st = getDBTransaction().createPreparedStatement("commit",1);Connection conn;String strAux = new String(path);strAux = strAux.concat("\rep_servicios.jasper"«»);HttpServletResponse response;response = null;String mensajeError = "";response.setContentType("application/html"«»);try { conn = st.getConnection(); st.close(); JasperReport jasperReport; jasperReport = (JasperReport)JRLoader.loadObject(strAux); Map parameters = new HashMap(); parameters.put("SUBREPORT_DIR",path); /* JasperViewer reporte = new JasperViewer(jasperPrint, false); reporte.setTitle("Impresión del Reporte de Servicios"«»); reporte.setVisible(true); reporte.show(); JasperViewer.viewReport(jasperPrint, false);*/ JRHtmlExporter exporter = new JRHtmlExporter(); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); //exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE); exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.setParameter(JRHtmlExporterParameter.OFFSET_X, new Integer(0)); exporter.setParameter(JRHtmlExporterParameter.OFFSET_Y, new Integer(0)); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"\rptServicios.html"«»); exporter.setParameter(JRHtmlExporterParameter.SIZE_UNIT, JRHtmlExporterParameter.SIZE_UNIT_POINT); exporter.exportReport(); response.setContentType ("application/html"«»); response.sendRedirect("C:\rptServicios.html"«»); }catch (JRException e) { mensajeError = "Error JR al intentar generar el reporte: "+e.getMessage(); } catch (Exception er) { mensajeError = "Error general al intentar generar el reporte: "+er.getMessage(); } } As you can see I was trying to deploy the report using JasperViewer, but it didn't work...Now I'm trying to use JRHtmlExporter but I facing the same problem... Please I need help¡¡¡Any help will be appreciate.Thanks a lot..Cheers,Nelis Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now