mr. Sandeep Chhabra
i flow to your give step
see my code
public String button2_action() {
JasperDesign jasperDesign = JasperManager.loadXmlDesign("f:/ireport/fahim.jrxml");
JasperReport jasperReport = JasperManager.compileReport(jasperDesign);
Map parameters = new HashMap();
parameters.put("pid", new Integer(19));
Connection conn = null ;
try {
javax.naming.Context ctx = new javax.naming.InitialContext() ;
DataSource ds = (DataSource)ctx.lookup(" java:comp/env/jdbc/Travel" ) ;
conn = ds.getConnection() ;
} catch (Exception ex) {
error(" Error counting rows: " + ex.getMessage() );
}
JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,parameters,conn);
JasperManager.printReportToPdfFile(jasperPrint, "BasicReport.pdf");
return null;
}
}
it only give me light green line where i use JasperManager word not error line
i import this file
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.design.*;
import java.util.*;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.view.JasperViewer;
//import net.sf.jasperreports.engine.JasperManager;
import net.sf.jasperreports.engine.JasperPrintManager;
and when i build my project then system give me error in output windows
============see my all error
Compiling 3 source files to C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\build\web\WEB-INF\classes
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:306: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown
JasperDesign jasperDesign = JasperManager.loadXmlDesign("f:/ireport/fahim.jrxml");
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:307: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown
JasperReport jasperReport = JasperManager.compileReport(jasperDesign);
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:318: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown
JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,parameters,conn);
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java:319: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown
JasperManager.printReportToPdfFile(jasperPrint, "BasicReport.pdf");
Note: C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\src\webapplication13\Page1.java uses or overrides a deprecated API.
Note: Recompile with -Xlint
eprecation for details.
4 errors
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\nbproject\build-impl.xml:233: The following error occurred while executing this line:
C:\Documents and Settings\Administrator\My Documents\Creator\Projects\WebApplication13\nbproject\build-impl.xml:122: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
please give me idea how i create pdf file
thank's
aamir