Hello everyone..
I am new to jasper reports i am using NEtBeans6.5.1 and dowloaded the jasper plugins 3.5.2 and have the jar file jasper report 3.6.2 from netbeans i develop a jrxml file but now when i am trying to call that file though
java code i am getting error like...
SEVERE: Servlet.service() for servlet action threw exception
java.lang.ClassNotFoundException: org.springframework.core.io.Resource
my code is..
public class SampleReportAction extends Action{
private ActionForward forward;
public SampleReportAction(){
super();
System.out.println("Call of Constructor");
}
DBUtil mdbc=new DBUtil();
Connection con = null;
Statement st=null;
ResultSet rs=null;
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception{
Statement stmt=null;
File path=new File(".");
String SrcFolder="",reportSource="",reportDest="";
try {
SrcFolder = path.getCanonicalPath();
} catch (IOException ex) {}
reportSource = SrcFolder + File.separatorChar + "report" + File.separatorChar + "templates" + File.separatorChar + "checking.jrxml";
System.out.println("After report source ----"+reportSource);
Map params=new HashMap();
String mode = request.getParameter("mode");
System.out.println("mode value :::" +mode);
if(mode.equalsIgnoreCase("print")){
try{
con=mdbc.getConnection();
System.out.println("After getting connection----");
String abc=getQuery();
params.put("Query",abc);
System.out.println(abc);
JasperReport jasperReport =JasperCompileManager.compileReport(reportSource);
System.out.println("After JasperComplie....");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,params,con);
JasperExportManager.exportReportToPdfFile(jasperPrint, "C:/Sadhat/sample_report");
boolean isExitOnClose = false;
JasperViewer view = new JasperViewer(jasperPrint,isExitOnClose);
view.pack();
view.setTitle("FirstIReport ");
view.setSize(1020,720);
view.setLocation(0,30);
view.setVisible(true);
JasperPrintManager.printReport(jasperPrint,true);
} catch(JRException ex){
ex.printStackTrace();
}
}
return forward;
}
public String getQuery(){
String Query="";
Query="select a.team,count(b.[user_id]),count(b.account_id) from [user] a, phone b where a.team is NOT NUll and a.[user_id]=b.[user_id] group by a.team;";
return Query;
}
}
PLease help me out... I will be pleased fr the one who help me out.. thanks in Advance...