raghavendram040
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Downloads
Posts posted by raghavendram040
-
-
I have a link in one jsp as,
<form action="VehicleReports"><a href="vehicleReport.jsp">Vehicle Report</a></form>I have writen VehicleReports servlet as,protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {Connection con=null;try{response.setContentType("application/pdf");con=VehicleDetails.getConnection();InputStream inputStream = new FileInputStream ("E:/ReportFld/report4.jrxml");Map parameters = new HashMap();JasperDesign jasperDesign = JRXmlLoader.load(inputStream);JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);@SuppressWarnings("unchecked")JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, con);JasperExportManager.exportReportToPdfFile(jasperPrint, "D:/reports/vehicle2_jasper.pdf");JasperExportManager.exportReportToPdfFile(jasperPrint, "D:/reports/vehicle2_jasper.pdf");int len = (int)new File("D:/reports/vehicle2_jasper.pdf").length();response.setContentLength(len);byte[] buf = new byte[len];FileInputStream pdfin = new FileInputStream("D:/reports/vehicle2_jasper.pdf");pdfin.read(buf);pdfin.close();OutputStream pdfout = response.getOutputStream();pdfout.write(buf,0,len);pdfout.flush();request.getRequestDispatcher("/vehicleReport.jsp").forward(request, response);}catch(Exception e){e.printStackTrace();}finally{try {con.close();} catch (SQLException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}and in vehicleReport.jsp I am trying to display the report as,<object data="D:/reports/vehicle2_jasper.pdf" type="application/pdf"><embed src="D:/reports/vehicle2_jasper.pdf" type="application/pdf"></object>but its not showing anything. . How to solve this. can anyone help me in this.
How to write conditional sql query for ireport parameter?
in Products
Posted
I am new to Ireport and jasperreport What I am trying is, I have a select dropdown in html shows groups once select a group and click submit it should generate report of all vehicles under that group. in dropdown I have a value All , If i select that it should generate report of all vehicle under perticuler user. So I have created parameters in I report as follow ,
$P{querycontroler}==>default value is :$P{gp}.equals("All")?$P{byuser}:$P{bygrp}
$P{bygroup}==>default value is:"SELECT * FROM vehicle_details where client_id=$P{user} and group_name=$P{gp}"
$P{byuser}==>default value is:"SELECT * FROM vehicle_details where client_id=$P{user}"
$P{gp}==>promts to enter group(selected dropdown value )
$P{user}==>promts to enter user(user who logged in application)
and when I write a report query as $P!{group} , it doesnt reads fields of table instead it just shows `Error:null`. How to solve this please help me in this.