-
FEATURED COMPONENTS
First time here? Check out the FAQ!
public void gen_report()
{
String fileName ="/home/drishti/tomcat624/webapps/Bankman/zul/Report/Account_CloseList_Report.jasper";
String outFileName ="/home/drishti/tomcat624/webapps/Bankman/zul/Report/ClosedAccountsList.pdf";
System.out.println("Path got");
String module,from_date,to_date;
Map hm = new HashMap();
try
{
System.out.println("in try");
String driver = "org.postgresql.Driver";//////com.mysql.jdbc.Driver
String connectString = "jdbc:postgresql://192.168.1.4:5432/bankman";
/////String connectString = "jdbc:postgresql://localhost:5432/YOUR_PG_DB_NAME";
String user = "abc";
String password = "abc";
Class.forName(driver);
Connection con = DriverManager.getConnection(connectString, user, password);
System.out.println("Connection Established");
if(dt_frmdate.getValue()==null)
{
//dt_frmdate.setFocus(true);
from_date="%";
//throw new WrongValueException(dt_frmdate,"Please, Select From Date....!");
}
else{
from_date=new SimpleDateFormat("yyyy-MM-dd").format(dt_frmdate.getValue());
System.out.println(""+from_date);
}
if(dt_todate.getValue()==null)
{
//dt_todate.setFocus(true);
to_date=new SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date())+"%";
//throw new WrongValueException(dt_todate,"Please, Select To Date...!");
}else {
to_date=new SimpleDateFormat("yyyy-MM-dd").format(dt_todate.getValue());
System.out.println(""+to_date);
}
hm.put("from_date",""+from_date);
hm.put("to_date",""+to_date);
System.out.println("values"+hm.values());
net.sf.jasperreports.engine.JasperPrint print = JasperFillManager.fillReport(fileName, hm, con);
System.out.println(" create JasperPrint using fillReport() method");
// Create a PDF exporter
JRExporter exporter = new JRPdfExporter();
System.out.println("2");
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
System.out.println("3");
// Export the file
exporter.exportReport();
System.out.println("4");
JasperViewer.viewReport(print, false);
}
catch (JRException e){
e.printStackTrace();
//System.out.println("Error Occured......"+e.getLocalizedMessage());
System.exit(1);
}
catch (Exception e){
e.printStackTrace();
//System.out.println("Exception IS"+e.getLocalizedMessage());
System.exit(1);
}
System.out.println("Report Generated.....");
}
This code given error as follows
Sourced file: inline evaluation of: `` gen . . . '' : Typed variable declaration : Class: net.sf.jasperreports.engine.JasperPrint not found in namespace : at Line: 224 : in file: inline evaluation of: `` . . . '' : net .sf .jasperreports .engine .JasperPrint
pls sugest proper solution
}
1.Check your classpath and see if you import all the classes you used in the zscript.
2.It's better not to use zscript for complicated logic.
Use composer to handle this , if there is any compiling error , IDE could help you debug it.
Asked: 2012-01-03 12:33:32 +0800
Seen: 153 times
Last updated: Jan 09 '12