• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to open a pdf report inside a jsf template?

 
thiago vargas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
thiago vargas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Tim!

I will use one of these options.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic