This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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.
Joined: Jul 05, 2012
Thank you for the aswer Tim,
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?
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.