1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
<% response.setHeader("Cache-Control","no-cache");%> //HTTP 1.1
<% response.setHeader("Pragma","no-cache");%> //HTTP 1.0
<% response.setDateHeader ("Expires", 0); %>
<%@ page import = "com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@ page import = "com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
<%@ page import = "com.crystaldecisions.sdk.occa.report.reportsource.IReportSource" %>
<%@ page import = "com.crystaldecisions.sdk.occa.report.data.*" %>
<%@ page import = "com.crystaldecisions.report.web.viewer.*" %>
<%@ page import = "com.crystaldecisions.sdk.occa.report.*" %>
<%@ page import = "com.crystaldecisions.sdk.occa.report.lib.*" %>
<%@ page import = "java.util.*" %>
<%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>
<%
Object reportSource = session.getAttribute("reportSource");
if (reportSource == null)
{
String report = "/reports/conge/coupon.rpt";
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(report, 0);
reportSource = reportClientDoc.getReportSource();
session.setAttribute("reportSource", reportSource);
}
//DEFINITION CHAMPS DE PARAMETRE
Fields fields = new Fields();
//champ de parametre : champ1
//champ de parametre string
ParameterField pfield1 = new ParameterField();
Values vals1 = new Values();
ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();
pfield1.setName("champ1");
pfield1.setReportName("");
String strParamVal = new String("1087");
pfieldDV1.setValue(strParamVal);
vals1.add(pfieldDV1);
pfield1.setCurrentValues(vals1);
fields.add(pfield1);
//CONNECTION
ConnectionInfos connInfos = new ConnectionInfos();
IConnectionInfo connInfo1 = new ConnectionInfo();
connInfo1.setUserName("xxx");
connInfo1.setPassword("xxx");
connInfos.add(connInfo1);
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setReportSource(reportSource);
viewer.setParameterFields(fields);
viewer.setEnableParameterPrompt(false);
viewer.setDatabaseLogonInfos(connInfos);
if (session.getAttribute("refreshed") == null)
{
viewer.refresh();
session.setAttribute("refreshed", "true");
}
viewer.setOwnPage(true);
try
{
viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
}
catch(ReportSDKException e)
{
System.out.println("exception : "+e);
e.printStackTrace();
}
%> |
Partager