Ireport - "Black Cat" problem

zhaozj2021-02-16  147

In these two days, I always took the time to study the "black cat" of this foreign import - IReport 0.5.x, I found that it is not easy to use, especially its information, yesterday, I built it yesterday. One of the simplest reports in the Jrviwer Previwer in Ireport, but I called when I was called in JSP, the report file reads an error, I checked for a long time, I found a half-day information in the online forum, I found it turned out. 0. 5. The version of X has this question. It is the report that the compiled serialization file does not have suffix jasper, you need to modify it, add this suffix to it, and call this compiled * .jasper file in JSP.

The code in JSP is as follows:

<% @ Page ContentType = "Text / HTML; Charset = GBK"%> <% @ Page Import = "Dori.jasper.Engine. *"%> <% @ page import = "DOR.JASPER.ENGINE.UTIL. * "%> <% @ page import =" dori.jasper.Engine.export. * "%> <% @ page import =" java.util. * "%> <% @ page import =" java.io. * " %> <% @ page import = "java.sql. *"%> <% connection conn = null; // below ignore the database connection process // ... try {class.forname ("com.microsoft.jdbc.sqlserver .Sqlserverdriver "); conn = java.sql.driverManager.getConnection (" JDBC: Microsoft: SQLSERVER: // localhost: 1433; DatabaseName = Bookshop "," SA "," 1 ");} catch (sqlexception ex) {EX .printStackTrace ();} catch (ClassNotFoundException ex) {ex.printStackTrace ();} // ...... File reportFile = new File (application.getRealPath ( "/ report / booksjasper.jasper")); Map parameters = new HashMap ( ); //Parameters.put ("Address report"); //parameters.put(/parameters.put(-, reportfile.getParentfile ()); byte [] bytes = jasperrunmanager.runreporttopdf (ReportFile.Get Path (), parameters, conn); response.setContentType ( "application / pdf"); response.setContentLength (bytes.length); ServletOutputStream ouputStream = response.getOutputStream (); ouputStream.write (bytes, 0, bytes.length) OuputStream.flush (); OuputStream.close ();%> This problem is solved.

But there is one

serious problem

转载请注明原文地址:https://www.9cbs.com/read-7981.html

New Post(0)