JasperPrintManager.printReport(jasperPrint,true)
I have a print button in jsp page that prints a report created in jasper. What does calling JasperPrintManager.printReport(jasperPrint,tru开发者_如何学运维e) in a jsp page actually do? I imagine it has to invoke a javascript command to bring up the print dialog and sends the data to it. It is not working for me. any idea?
No javascript whatsoever. JSP pages are compiled to regular HttpServlet
s, so perhaps it is executed on doGet(..)
i.e. on loading of the page. This however prints the document on the server.
If you want to print on the client, then you will need an Applet. Or, better, export in PDF and send the PDF to the user for printing.
Export your JasperPrint file to a PDF file. Set the content type on the response to "application/pdf". Finally redirect the response with the streamed PDF.
You can do it in one JSP, but thats not the best solution, better to create your own ReportServlet
精彩评论