java - How to display DynamicReports in browser without download to cliend drive? -
i have display reports dynamic reports. use netbeans , tomcat 7. eventually, must uploaded cloud openshift. used dynamicreports create simple report (code snippet):
connection conn=null; try { class.forname(dbconnstrings.driver); conn = drivermanager.getconnection(dbconnstrings.url + dbconnstrings.dbname+dbconnstrings.sslstate, dbconnstrings.username, dbconnstrings.password); } catch (exception e) { e.printstacktrace(); } jasperreportbuilder report = dynamicreports.report(); report .columns( columns.column("tank id", "id", datatypes.integertype()), columns.column("tank name", "name", datatypes.stringtype()), columns.column("label", "label", datatypes.stringtype()), columns.column("description", "descrshort", datatypes.stringtype())); report.setdatasource("select id, name, label, descrshort "+ dbconnstrings.dbname +".tbltankslist", conn); try { //show report //report.show(); //export report pdf file report.topdf(new fileoutputstream("c:/report.pdf")); } catch (drexception e) { e.printstacktrace(); } catch (filenotfoundexception e) { e.printstacktrace(); }
this code located in servlet. works. jasperviewer @ first , report.pdf on hdd. don't want it. first not want see jasperviewer, second not want download file client hdd. how display report inside web-browser only?
here question jasper reports. jasper reports + ireport , have no idea how use information dynamicreports - @ first, second there "download pdf client drive" approach, need show inside browser.
use following code in file redirect towards jasper invocation page, jasperpdf should open in new tab instead of downloading.
jasperinvocation.jsp => file in invoke jasperreport
<form method="post" action="jasperinvocation.jsp" target="_blank">
Comments
Post a Comment