archimede76 Posted March 17, 2009 Share Posted March 17, 2009 Hi all, i'm italian developer and this is my first post.In my JSP web application, developed with Eclipse, all work good. I have more and more report and i open this correct with the posted servlet and all work good. Now, yesterday i have a report with subreport create. If i open this from iReport IDE, all work good and i see the report (with subreport inside) correct. If i put the files report.jasper and subreport.jasper in report folder of my application, and i click on the "report open" button of my web page, i see not error message but a blank page.I have choose the option "put the subreport path in a parameter SUBREPORT_DIR" and i give this parameter from serlvet, with same path of main report. I think, the cause of problem is subreport path.Can help me?Very thank,ArchimedeCode:protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String rptFileName = request.getParameter("rptFileName").toString(); String rptFolder = "/report/"; JasperPrint jp = null; ServletContext context = this.getServletContext(); Map parameters = new HashMap(); parameters.put("mainid", new Integer (64)); parameters.put("SUBREPORT_DIR", context.getRealPath(rptFolder)); String cnHost = "localhost"; String cnName = "edilgestdb"; String cnLogin = "edilgestuser"; String cnPsw = "edilgestpsw"; Connection Conn = null; try { Class.forName("org.postgresql.Driver").newInstance(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { Conn = DriverManager.getConnection("jdbc:postgresql://"+cnHost+"/" + cnName + "?user=" + cnLogin + "&password=" + cnPsw); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { jp = JasperFillManager.fillReport(context.getRealPath(rptFolder + rptFileName + ".jasper"), parameters, Conn); } catch (JRException e) { // TODO Auto-generated catch block e.printStackTrace(); } ServletOutputStream outStream = response.getOutputStream(); try { JasperExportManager.exportReportToPdfStream(jp, outStream); } catch (JRException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now