Jump to content
We've recently updated our Privacy Statement, available here ×

mimiekimm

Members
  • Posts

    2
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Everything posted by mimiekimm

  1. seems like i need to get the 'reports' folder into web. problem solved
  2. Hello everyone. I just encountered new problem. before this my jasper report is okay. but then i changed the directory of my file but moving my project into a new folder. sub-folder in my project. im using netbaens and using jsp. before this, there is no problem at all to generate the report, but then yesterday, after i did the moving all files, when i try to generate the report, it return error:null. i have check all libraries and everthing. im using jdk 7. my jasper report plug in is version 5.6.0 and it is the same as my jasperreport.jar 5.6.0. i have tested all the path at my path which something like this File reportFile = new File(application.getRealPath("..//reports//test.jasper")); i have tried so many time changed it to many possible path but is seems to get error here is the full coding to generate the report <%@page import="Config.Config"%><%@page import="dBConn.Conn"%><%@page import="java.io.*"%> <%@page import="java.sql.Connection"%> <%@page import="java.sql.DriverManager"%><%@page import="java.util.HashMap"%><%@page import="java.util.Map"%><%@page import="net.sf.jasperreports.engine.*"%><%@page import="main.RMIConnector"%><%@page import="java.util.ArrayList"%> <%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE html><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://10.73.32.200:3306/emedica?zeroDateTimeBehavior=convertToNull", "root", "qwerty"); File reportFile = new File(application.getRealPath("..//reports//test.jasper")); Map map = new HashMap(); byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(),map,conn); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream outStream = response.getOutputStream(); outStream.write(bytes, 0, bytes.length); outStream.flush(); outStream.close(); } catch (Exception ex) { out.println("Error: " + ex.getMessage()); } %> </body></html> i think my main problem is the path, anyone has idea?thanks
×
×
  • Create New...