on 09-17-2008 8:27 AM
Hello
this my programmes , it work it's ok ( see bottom of the page )
Now i have a rapport rpt with a input edit (example number customer )
I want by my file jsp that the number customer display automatically
in my rapport rpt ( variable string or integer or date) and after validate automaticcaly
and connection to my database automartically ( database oracle 8 user and paswword)
(by example with my url , i pass a parameters input and automatically i will see
the rapport rpt ) it's possible , How to make in jsp ?
thanks to help me
regards
Michel
this programmes are ok (but now i search to display a variable on my report)
-
via url
CrystalReportViewer.jsp
--------------------------------------
<%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
<%
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setName("CrystalReportViewer");
viewer.setOwnPage(true);
//Enable Active-X print mode.
viewer.setPrintMode(CrPrintMode.ACTIVEX);
//Obtain report source of the report that the viewer will display.
Object reportSource = session.getAttribute("reportSource");
viewer.setReportSource(reportSource);
viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
%>
view_report.jsp
-----------------------
<%
/*
* Applies to Versions: XI
* Creation Date: Febuary 28 2005
* Description:
* This sample to demonstrates how to view a Crystal Report on demand in
* the zero-client DHTML viewer.
* Author: CW.
*/
%>
<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*,
com.crystaldecisions.sdk.plugin.desktop.common.*,
com.crystaldecisions.sdk.framework.*,
com.crystaldecisions.sdk.occa.security.*,
com.crystaldecisions.sdk.exception.SDKException,
com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory,
java.util.Locale,
com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"
%>
<%@ include file = "logonform.jsp" %>
<%
String cms = request.getParameter("cms");
String user = request.getParameter("user");
String pass = request.getParameter("pass");
String sdocName = request.getParameter("sdoc");
try {
//If logon information is required, display the logonForm and exit.
//Create a special logon form that requests 2 Report Names
//(code for LogonForm class is included).
LogonForm logonform = new LogonForm(response, request, LogonForm.REPORT_NAME);
//if (logonform.display_if_needed()) return;
// ici doit recuperer le nom du document
logonform.reportname[0] = sdocName ; //"diagramme";
//Log in.
IEnterpriseSession enterpriseSession = CrystalEnterprise.getSessionMgr().logon(user,pass,cms,"secEnterprise");
//Grab the InfoStore from the httpsession
IInfoStore infoStore = (IInfoStore)enterpriseSession.getService("", "InfoStore");
//Query for the report object in the CMS. See the Developer Reference guide for more information the query language.
IInfoObjects oInfoObjects = (IInfoObjects)infoStore.query("SELECT TOP 1 * " +
"FROM CI_INFOOBJECTS " +
"WHERE SI_PROGID = 'CrystalEnterprise.Report' AND SI_INSTANCE=0 AND SI_NAME='" + logonform.reportname[0] + "'" );
if (oInfoObjects.size() > 0) {
//Retrieve the latest instance of the report
IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(0);
//Use the PS report factory to obtain a report source that will be processed on the Page Server.
IReportSourceFactory factoryPS = (IReportSourceFactory)enterpriseSession.getService("PSReportFactory");
Object reportSource = factoryPS.openReportSource((oInfoObject), Locale.ENGLISH);
session.setAttribute("reportSource", reportSource);
//View the report in the standard DHTML viewer.
response.sendRedirect("CrystalReportViewer.jsp");
}
else {
out.println("Report " + logonform.reportname[0] + " not found.");
}
}
catch(SDKException sdkEx) {
out.println(sdkEx);
}
%>
logonform.jsp
---------------------
<%!
/**************************** class LogonForm ***************************
*
* This logon form is used to gather the logon information needed
* to login to Enterprise
*
***********************************************************************/
private class LogonForm {
HttpServletResponse response;
HttpServletRequest request;
int num_reports_needed = 1;
String[] reportname;
public static final int NONE = 0;
public static final int REPORT_NAME = 1;
public static final int REPORT_NAME_X2 = 2;
/************************************************************************
*
* Constructor - Save the response and request objects
*
***********************************************************************/
LogonForm(HttpServletResponse response, HttpServletRequest request)
{
//this.response = response;
//this.request = request;
}
/************************************************************************
*
* Constructor with options - Add some optional boxes to request other
* input from the user such as reportnames.
*
***********************************************************************/
LogonForm(HttpServletResponse response, HttpServletRequest request, int extra_requests) {
this.response = response;
this.request = request;
switch (extra_requests) {
case NONE:
break;
case REPORT_NAME:
num_reports_needed = 1;
reportname = new String[1];
break;
case REPORT_NAME_X2:
num_reports_needed = 2;
reportname = new String[2];
break;
}
}
}
%>
Edited by: Moulery michel on Sep 17, 2008 9:37 AM
Edited by: Moulery michel on Sep 17, 2008 9:39 AM
Hello Moulery,
as you are using Java code to connect ot BO enterprise
I recommend to post this query to the [.Java Development - BusinessObjects Enterprise, BusinessObjects Edge, Crystal Reports Server|;.
This forum is dedicated to development and deployment of Java applications that connect and interact with BusinessObjects Enterprise, BusinessObjects Edge, or Crystal Reports Server. This includes the development of applications using the BusinessObjects Enterprise, Report Application Server, Report Engine, and Web Services SDKs.
It is monitored by qualified technicians and you will get a faster response there.
Also, all BOE - JAVADevelopment queries remain in one place and thus can be easily searched in one place.
Best regards,
Falk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.