File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Creating Jasper Report at client machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Creating Jasper Report at client machine" Watch "Creating Jasper Report at client machine" New topic

Creating Jasper Report at client machine

Dhana Sen
Ranch Hand

Joined: Mar 05, 2006
Posts: 33
Hi all,

am creating web based project.During run time i want to create REPORT.. am using JASPER REPORT(opensource -(Struts + hibernate + Jasper Report)).
right now am able to generate the report at run time.. but am getting it in Server..

my code:
InputStream is = getServlet().getServletContext().getResourceAsStream("/WEB-INF/config/report.jrxml");
JasperDesign design = JRXmlLoader.load(is);
JasperReport report = new JasperCompileManager().compileReport(design);
JasperPrint print =JasperFillManager.fillReport(report, parameters, new ManipulateReport(excereportlist, fields));
// View the Report


if am running project in client.. and if i click the button (Report).. my report was opening in Server Machine ...

i need my report should be open in my Client machine..
is there any other way.. where i can open my report in client.. / any other class in Jasper Report..

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Does viewReport open a new Java (i.e., AWT or Swing) window? That, obviously, can not open on the client, because the JVM is on the server. But JasperReports can generate HTML reports, which you can display to the client, or you can have it generate PDF, which you can show to the client.
Subhashini Sekar

Joined: Nov 15, 2005
Posts: 9
Try these line in a

pdfasbytes = JasperExportManager.exportReportToPdf(jasperPrint);
outstream = res.getOutputStream();
String strSettings = "inline;filename=\"abc.pdf\"";
res.setHeader("Content-Disposition", strSettings);
outstream.write(pdfasbytes, 0, pdfasbytes.length);
I agree. Here's the link:
subject: Creating Jasper Report at client machine
It's not a secret anymore!