我遇到来自JSP的call crystal reports viewer的问题,这是我的项目结构:
CrystalReport-viewer.jsp可以调用水晶报表查看器(Web内容中的文件),但名为Viewer1.jsp的文件无法调用水晶报表查看器。为什么?因为目录文件夹是jsp吗?错误显示:
The viewer was unable to find the resources required to render the report.
Please check the following to resolve the issue.
1. Verify that ../crystalreportviewers/ is accessible to your WebApp and is the correct path to the viewer resources.
2. You may customize this location by altering the crystal_image_uri and crystal_image_use_relative properties in the web.xml.
3. Validate that the file crv.js exists at ../crystalreportviewers/js/crviewer/crv.js.
Viewer1.jsp
<%
String report_name = "/modules/testing/Report2016.rpt";
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(report_name, OpenReportOptions._openAsReadOnly);
ParameterFieldController parameterFieldController = reportClientDoc
.getDataDefController().getParameterFieldController();
CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
IReportSource reportSource = reportClientDoc.getReportSource();
crystalReportPageViewer.setReportSource(reportSource);
crystalReportPageViewer.setReportSource(reportSource);
crystalReportPageViewer.setOwnPage(true);
crystalReportPageViewer.processHttpRequest(request, response,
application, null);
%>
我用java servlet调用jsp。是否必须在web.xml中创建配置?如何解决这个问题?感谢。