Win a copy of Terraform in Action this week in the Cloud forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

struts-jasper report-pdf-jsp

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I am new here and also in using struts. I have this problem I encountered when I integrate jasper report with struts.
I am able to produce the pdf of my report but then i want it to be place it inside a frame in my jsp page.

What will I do? any suggestion?


public class GenerateReportAction extends Action {

private static Logger log = Logger.getLogger(GenerateReportAction.class);

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

ActionForward forward = new ActionForward();
GenerateReportForm jform = (GenerateReportForm) form;

InputStream is = JSFHelper.getCurrentLoader("").getResourceAsStream("/jasper/sampleLetter.jasper");"value of InputStream " + is);


JasperReport jasperReport = (JasperReport)JRLoader.loadObject(is);
JasperPrint jasperPrint = (JasperPrint)JasperFillManager.fillReport(jasperReport,new HashMap(),newJREmptyDataSource());

request.setAttribute("resourceReports", jasperPrint);

catch(Exception e){



forward = mapping.findForward("success");
return forward;



public class GenerateReportForm extends ActionForm {

//nothing here



in my jsp:

<html:form action="generateReport">

<input type="submit" name="cmdGenerate" id="cmdGenerate" value="Generate" class="buttons" />

<iframe id="pdfFrame" width="100%" height="500px"




<form-bean name="generateReportForm" type="sample.form.GenerateReportForm"></form-bean>

<action path="/generateReport"

<forward name="success" path="/jsp/genRepLet.jsp"></forward>

Thank you in advance.
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi mizkhyz garcia,
I started using Jasper Reports in my application but could not find correct process to implement this.
I am using struts with hibernate could please guide me to implement jasper reports in my application.
can you give me the code to use jasper reports and the procedure to follow to implement this.

kindly please help me.
thanks in advance

naresh kumar k
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic