
Hi,
I am working with spring jasper integration to generate the jasper reports. Spring 3.0.5RELEASE,ireport 4.5.0
I generated a report template using the ireport.My spring controller class is returning the view and i am using the view resolver in the dispatcher-servlet.xml.I placed the views.properties file in the classpath of my project to render the view in pdf format.The below lines of code i am using in the views.properties file.
packageWisePdfView.class=org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView packageWisePdfView.url=/WEB-INF/packagewisereport1.jrxml
Where packageWisePdfView is my jsp name which is returned by the spring controller class.Using .class i am telling that render the pdf view.Using url i am telling where my jrxml is located.
Main thing is my packageWisePdfView.jsp is empty because i dont know what code i have to place over there.I am thinking that if i configure the view class in my views.properties file then it will automatically render the view to my packageWisePdfView.jsp.I dont know i am thinking in the correct way or not.But if i do like this i am getting the emptypage.Anything more i have to do.I am new to the jasper as well as spring also.Can any one help me regarding this.Please.....
Below is my controller class code:
public ModelAndView addTemplate(@ModelAttribute("reports") RaReports model, HttpServletRequest request,HttpServletResponse response) throws Exception {
String pdfFile =request.getSession().getServletContext().getRealPath("/") +"packagewisereport.pdf";
String jasperFile = request.getSession().getServletContext().getRealPath("/") + "packagewisereport1.jrxml";
JasperDesign jasperDesign = JRXmlLoader.load(new File(jasperFile));
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint print = JasperFillManager.fillReport(jasperReport, map, conn);
JRPdfExporter jrPdfExporter = new JRPdfExporter();
jrPdfExporter.setParameter(JRExporterParameter.JASPER_PRINT,print);
jrPdfExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,pdfFile);
jrPdfExporter.exportReport();
return new ModelAndView("packageWisePdfView");
}
packageWisePdfView.jsp is empty i dont know what to write over there.Its very urgent to me can anyone please help me....
Thanks In Advance...
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.