Jump to content
Changes to the Jaspersoft community edition download ×

shatireazam

Members
  • Posts

    1
  • Joined

  • Last visited

shatireazam's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare

Recent Badges

0

Reputation

  1. Hello, I am a newbie to Java. I'm trying to generate reports with jasper in netbeans 6.1. My code given below, runs well in Java desktop application but in jsp it does not give any error and simply render the html but no report shows up (not even empty) nor any error message. I know i'm missing a very simple and stupid step but does not know what. Can somebody help me with Java code and explain why does it work in java desktop application but not in JSP? Thanks in advance. Code:try{ Map m=new HashMap(); m.put("proName", "General"); //Parameters to be sent to report m.put("spID", 37); //Parameter to be sent to report String reportSource = "/report/report1.jrxml"; //report folder is in WebPages folder String reportDest = "/report/report1.html"; JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); Class.forName("com.mysql.jdbc.Driver"); Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/lisdb", "root", "samsung"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, m, con); JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest); JasperViewer.viewReport(jasperPrint); } catch (JRException e){ e.printStackTrace(); } catch (ClassNotFoundException ex){ ex.printStackTrace(); } // Exception handling for the DriverManager.getConnection method. catch (SQLException ex){ ex.printStackTrace(); }
×
×
  • Create New...