gmeka
gmeka

Reputation: 4289

How to make struts2 load a dynamically generated pdf file in browser

I am using Struts2 framework for my webapp. The idea is that user select dates for which he wants report. depending on these details a pdf report is generated on the fly. Upto this point everything is working fine as expected.

But I want to open the generated report in the browser. How can I do that?? Thanks in advance.

Upvotes: 0

Views: 2756

Answers (1)

Andrea Colleoni
Andrea Colleoni

Reputation: 6021

You have two options:

  1. Use JasperReports struts2 plugin and then have a new jasperreport result type
  2. Use the stream result type and have in your action an InputStream property to pass to the stream result type configuration, toghether with MIME type (application/pdf in your case) and file name. Yopu will set in your action the InputStream to a stream containing your PDF bytes

Upvotes: 3

Related Questions