cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Angus Miller" <all4mil...@lycos.com>
Subject URGENT JSP for PDF generation
Date Thu, 21 Aug 2003 14:40:59 GMT
Hi All,

I have been using JasperReports and wanted to intergrate with Cocoon. I using some java code
in JSP page and works fine but the rendered PDF document never has any content

here is jsp code:

<%@ page language="java" %>
<%@ page import="dori.jasper.engine.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%

    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    String url = "some-url";
    String userName = "username";
    String password = "password";

    Connection conn = DriverManager.getConnection (url, userName, password);

	File reportFile = new File(application.getRealPath("/reports/Demo.jasper"));

	Map parameters = new HashMap();

	byte[] bytes =
		JasperRunManager.runReportToPdf(
			reportFile.getPath(),
			parameters,
			conn
			);


	response.setContentLength(bytes.length);
	ServletOutputStream ouputStream = response.getOutputStream();
	ouputStream.write(bytes, 0, bytes.length);
	ouputStream.flush();
	ouputStream.close();

%>


here is the sitemap match element that catches the call:

      <map:match pattern="*.rep">
        <map:read type="jsp" src="{1}.jsp" mime-type="application/pdf" />
      </map:match>



the pdf pages get generated but they always come out blank. I have tested the jsp inside another
non-cocoon webapp and it then works.

Any help will be great 


Thanks
Angus



____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message