Hey Guy, I usually do so in a servlet to open my report in a new window Map parameters = new HashMap(); parameters.put("ID", Integer.parseInt(id));
Connection dbconn = null; try { logger.info("Create PDF "); Class.forName(DBSettings.dbdriver).newInstance(); dbconn = (Connection) DriverManager.getConnection(DBSettings.dburl, DBSettings.dblogin, DBSettings.dbpass); // ..Load project report // InputStream stream = getServletContext().getResourceAsStream( // "/nxcontrol/reports/cbrGaragem00.jrxml"); // ..make // JasperReport relatorio = JasperCompileManager // .compileReport(stream); InputStream relatorio = getServletContext().getResourceAsStream("/nxcontrol/reports/cbrGaragem.jasper"); //..preenche JasperPrint jprint = JasperFillManager.fillReport(relatorio,parameters, dbconn); //..export to pdf byte[] arquivo = JasperExportManager.exportReportToPdf(jprint); // ..define type the returne response.setContentType("application/pdf"); response.setContentLength(arquivo.length); // ..returne report OutputStream ouputStream = response.getOutputStream(); ouputStream.write(arquivo, 0, arquivo.length); ouputStream.flush(); ouputStream.close(); 2010/5/7 bhargava <bhargav...@gmail.com> > Hey Guys, > I have integrated Jasper Reports on my netbeans platform and i am able > to generate reports using the following code. > > Map<String, Object> params = new HashMap<String, Object>(); > Connection conn = > DriverManager.getConnection("databaseUrl", "userid","password"); > JasperReport jasperReport = > JasperCompileManager.compileReport(reportSource); > JasperPrint jasperPrint = > JasperFillManager.fillReport(jasperReport, params, conn); > JasperExportManager.exportReportToHtmlFile(jasperPrint, > reportDest); > JasperViewer.viewReport(jasperPrint); > > This stuff works perfect. > > But not i am trying to integrate Jasper with GWT.I have my server as > glass fish server. > > I am getting the Connection object using the followind code. > > public static Connection getConnection() { > > try { > String JNDI = "JNDI name"; > InitialContext initCtx = new InitialContext(); > javax.sql.DataSource ds = (javax.sql.DataSource) > initCtx.lookup(JNDI); > Connection conn = (Connection) ds.getConnection(); > return conn; > } catch (Exception ex) { > ex.printStackTrace(); > } > return null; > } > > and then > > Map<String, Object> params = new HashMap<String, Object>(); > JasperReport jasperReport = > JasperCompileManager.compileReport(reportSource); > JasperPrint jasperPrint = > JasperFillManager.fillReport(jasperReport, params, getConnection()); > JasperExportManager.exportReportToHtmlFile(jasperPrint, > reportDest); > JasperViewer.viewReport(jasperPrint); > > but i always get Error.I am implementing this on Server.I am having > RPC calls to get this method to work when a button is clicked. > > Can you please help me how to work on this.(That is to integrate > Jasper reports with GWT). > > I would highly appreciate any explanation with some code as i am just > a beginner. > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to google-web-tool...@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.