Results 1 to 2 of 2
  1. #1
    sanduta is offline Member
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    Default Problem with a report

    I had don a report in iReport and i wont to put in a java file.
    I did this button and this acction:
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    String raport = "./rapoarte/classic.jasper";
    String outFileName = "/rapoarte/raport1.pdf";
    HashMap hm = new HashMap();

    String edit, anul, anul1;

    hm.put("nume", edit);
    hm.put("prenume", anul);
    hm.put("data_internare",anul1);

    try {
    JasperReport jasperReport = JasperCompileManager.compileReport(raport);
    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, hm, cnx);
    JasperViewer.viewReport(jasperPrint, false);

    }
    catch (JRException ex) {
    ex.printStackTrace();
    }
    }

    I have an error in this lines:
    hm.put("nume", edit);
    hm.put("prenume", anul);
    hm.put("data_internare",anul1);

    variable edit might not have been initialized

    Help me please

  2. #2
    pao
    pao is offline Member
    Join Date
    Jun 2008
    Posts
    43
    Rep Power
    0

    Default

    Initialise the reference 'edit' before you try to pass into a method....

    Java Code:
    String edit, anul, anul1;
    
    hm.put("nume", edit);

Similar Threads

  1. Crystal report with JSP
    By fred in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 12-17-2008, 09:27 PM
  2. Error With Sql And Jasper Report
    By Heather in forum JDBC
    Replies: 4
    Last Post: 12-03-2008, 12:31 PM
  3. Jasper report + JPQL
    By tarat in forum Advanced Java
    Replies: 2
    Last Post: 08-01-2008, 07:47 PM
  4. Crystal Report with Java
    By Jack in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2007, 02:39 PM
  5. Big Faceless Report Generator 1.1.36
    By levent in forum Java Software
    Replies: 0
    Last Post: 06-20-2007, 08:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •