Jump to content

smilegloria

Members
  • Posts

    4
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Everything posted by smilegloria

  1. Hi all, Please help with my encountered problem! I have a master report with different sub-reports created with iReport 1.3.2. The master report can be run with the pdf engine inside iReport. But then when i put the jasper files to my Tomcat application and called the master.jasper via a servlet, the following error comes out. Class not found when loading object from file: /usr/local/tomcat/webapps/motor/master.jasper All the jasper files are put in /usr/local/tomcat/webapps/motor directory. And here are the coding in servlet Code: import javax.naming.*; import javax.sql.*; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.export.*; import java.util.*; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; //import dori.jasper.engine.*; public class PrintForm extends HttpServlet { private ServletContext application; public void init(ServletConfig config) throws ServletException { super.init(config); } public void destroy() { } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { application = getServletConfig().getServletContext(); File reportFile = new File(application.getRealPath("/master.jasper"«»)); BufferedReader input = new BufferedReader(new FileReader(reportFile)); String connstr = input.readLine(); input.close(); Map parameters = new HashMap(); parameters.put("quono", request.getParameter("quono"«»)); parameters.put("clauses", request.getParameter("clauses"«»)); parameters.put("namedDriver_percentage", request.getParameter("namedDriver_percentage"«»)); parameters.put("travelToChina_percentage", request.getParameter("travelToChina_percentage"«»)); parameters.put("rebate", request.getParameter("rebate"«»)); parameters.put("loading", request.getParameter("loading"«»)); parameters.put("mib", request.getParameter("mib"«»)); // Get connection to PMDDLIB String DbDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; String DbUrl = "jdbc:microsoft:«»sqlserver://10.168.2.41:1433;databasename=QM_SYS"; String DbUser = "qmsys"; String DbPassword = "it06cyber97"; Connection dbCon = null; Class.forName(DbDriver); dbCon = DriverManager.getConnection(DbUrl, DbUser, DbPassword); byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters, dbCon); response.setContentType("application/pdf"«»); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } catch(Exception ioe) { System.err.println(ioe.getMessage()); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } } The PrintForm class is put inside /usr/local/tomcat/webapps/motor/WEB-INF/classes Anyone can help? Many thanks, Gloria
  2. Hi Kaunietiss, Thanks for the information, i can create the subreport successfully. It was due to the page size problem of the one i created, now fixed! Thanks, Gloria
  3. Or can anyone share a sample with 2 subreports that contains only static text? Thanks
  4. Hi all, I want to create a iReport with 7 pages but I don't know how it can be done with iReport. I tried to create subreports for each page and create another main report to put these 7 subreports to it but finally the report displayed as a blank PDF. Please help! Million thanks! Best Regards, Gloria
×
×
  • Create New...