• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Creating Jasper Report at client machine

 
Ranch Hand
Posts: 33
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
JasperViewer.viewReport(print,false);

*************************

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..



Thanks
Dhana
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try these line in a

pdfasbytes = JasperExportManager.exportReportToPdf(jasperPrint);
outstream = res.getOutputStream();
res.setContentType("application/pdf");
res.setContentLength(pdfasbytes.length);
String strSettings = "inline;filename=\"abc.pdf\"";
res.setHeader("Content-Disposition", strSettings);
outstream.write(pdfasbytes, 0, pdfasbytes.length);
outstream.flush();
 
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!