wood burning stoves 2.0*
The moose likes JSF and the fly likes How to open a pdf report inside a jsf template? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to open a pdf report inside a jsf template?" Watch "How to open a pdf report inside a jsf template?" New topic
Author

How to open a pdf report inside a jsf template?

thiago vargas
Greenhorn

Joined: Jul 05, 2012
Posts: 4
How to open a pdf report inside a jsf template?

So, I need open one jasperReport inside a template, how do I do that?

If there's any other alternative besides pdf, please let me know.

Thank's
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962
    
  19

Welcome to the JavaRanch, Thiago!

JSF is designed to render HTML and PDFs are not in HTML form. So as a general rule, you'll get a cleaner program by outputting PDFs via non-JSF components of your webapp.

This is especially true if you are attempting to create the PDF dynamically using the Jasper report writer. You really should run Jasper from a servlet.


Customer surveys are for companies who didn't pay proper attention to begin with.
thiago vargas
Greenhorn

Joined: Jul 05, 2012
Posts: 4
Thank you for the aswer Tim,

That's true...
But actually I have two sources of report. One is JSF components that lists the report in the center of the page. The other is a download of the same report in PDF from jasper source, for the convenience of the customer.
And in the future, I will need to modify this report, and of course, modify two codes. So, I want only one source to keep.

Is it possible to have a flash component like a p:media of primefaces that shows a youtube video on a part of the screen?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962
    
  19

You cannot literally embed a PDF in an HTML page. Especially in Internet Explorer, which is forbidden on legal grounds from displaying PDFs in web browser windows altogether. JSF doesn't even figure there. About the closest you could get would be to use a embedded display medium like a snapshot picture, Flash, or HTML5.

Another option since you're using a report generator would be to make it render the report in HTML output for the web page view, though. Although it's fashionable to hate frames, that's the approach I'd most likely use if I wanted to mix JSF and HTML report on the same page.

An alternative would be to render the HTML to a backing bean property and use the non-escape option of the outputText tag to display it.
thiago vargas
Greenhorn

Joined: Jul 05, 2012
Posts: 4
Thank you very much Tim!

I will use one of these options.
 
 
subject: How to open a pdf report inside a jsf template?
 
Similar Threads
How to open a pdf file from Swing Panel?
Jasperreports PDF
Reports
downloading generated report in JSF
opening a file