when i am compiling a jrxml file created using ireport and exporting it how to export this page in a particular section of a jsp page I searched a lot in google i am not gettting any solutions related to my requirements
if i am writing something in the jsp page nothing is showing only the report getting visible
my code in jsp page is:--
<%@ page language="java" import="net.sf.jasperreports.engine.*" %>
<%@ page language="java" import="net.sf.jasperreports.engine.export.*" %>
<%@ page import="java.sql.*,java.io.*" %>
<%
String filename = request.getParameter("filename");
String reporttype = request.getParameter("reporttype");
System.out.println(filename);
System.out.println(reporttype);
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/kms","root", "root");
System.out.println("Connection Established");
String path = application.getRealPath("/");
System.out.println(path);
JasperPrint jasperPrint = JasperFillManager.fillReport(path + "/reports/" + filename, null, con);
System.out.println("Report Created...");
OutputStream ouputStream = response.getOutputStream();
JRExporter exporter = null;
if( "pdf".equalsIgnoreCase(reporttype) )
{
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline; filename=\"file.pdf\"");
exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
}
try
{
exporter.exportReport();
}
catch (JRException e)
{
throw new ServletException(e);
}
finally
{
if (ouputStream != null)
{
try
{
ouputStream.close();
}
catch (IOException ex)
{
System.out.println("exception thrown");
}
}
}
%>