日期:2014-05-16  浏览次数:20435 次

JSP调用水晶报表问题
我用的框架是spring+ibatis+struts
由于业务需求,要用jsp调用水晶报表,现在基本已经完成了,但是
报表上的打印和导出不能用,点击只是刷新一下,就没了。请问各位
大哥遇到过这样问题么?请赐教!非常感谢!
这里我把一个jsp页面贴出来:
<%@page import="com.crystaldecisions.report.web.viewer.CrPrintMode"%>
<%@ page contentType="text/html; charset=gb2312"%>


<%@ page
import="com.crystaldecisions.reports.reportengineinterface.*,
com.crystaldecisions.sdk.occa.report.exportoptions.*,
com.crystaldecisions.report.web.viewer.*,
com.crystaldecisions.sdk.occa.report.reportsource.*,
com.crystaldecisions.reports.sdk.*,com.businessobjects.samples.pojo.*,
com.dne.kiss.smsreport.vo.StatEngineerPointReport,
java.sql.*,
java.util.*"%>


<%
String report = "reports/getEngineerPoint.rpt";
ReportClientDocument rcd = new ReportClientDocument();
rcd.open(report, 0);
DatabaseController dbc = rcd.getDatabaseController();
//Create the POJO collection and populate it with data


int i = 0;
List list = (List) session.getAttribute("engineerPointList");
StatEngineerPointReport[] data = new StatEngineerPointReport[list.size()];
if (list != null && list.size() > 0) {
Iterator iter = list.iterator();
while (iter.hasNext()) {
data[i++] = (StatEngineerPointReport) iter.next();
}
}

//Create the result set from the collection of POJOs
POJOResultSetFactory factory = new POJOResultSetFactory(
StatEngineerPointReport.class);
factory.setVerbose(true);
POJOResultSet results = factory.createResultSet(data);
ResultSetMetaData metaData = results.getMetaData();
//Set the resultset as the report datasource
//Get the table name from the 'Set Datasource Location' dialog in the Crystal Reports designer
String reportTable = "getEngineerTable";
dbc.setDataSource(results, reportTable, reportTable);
IReportSource reportSource = rcd.getReportSource();
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setOwnPage(true);
viewer.setReportSource(reportSource);
viewer.setDisplayGroupTree(false);
viewer.setPrintMode(CrPrintMode.ACTIVEX);
//viewer.setPrintMode(CrPrintMode.PDF);
//viewer.refresh();

viewer.processHttpRequest(request, response, getServletConfig()
.getServletContext(), null);
%>

1 楼 sunchenjava 2007-12-06  
我用的是javaBean连接水晶报表,用sql查出相应的list传到上面页面,然后显示。现在就是不知道导出和打印怎么做?也从望上找了很多方法,但感觉不太合适。因为项目比较紧,时间非常急,还多请各位帮忙?