Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Qualcomm Snapdragon X2 Elite: l'architettura del SoC per i notebook del 2026
Qualcomm Snapdragon X2 Elite: l'architettura del SoC per i notebook del 2026
In occasione del proprio Architecture Deep Dive 2025 Qualcomm ha mostrato in dettaglio l'architettura della propria prossima generazione di SoC destinati ai notebook Windows for ARM di prossima generazione. Snapdragon X2 Elite si candida, con sistemi in commercio nella prima metà del 2026, a portare nuove soluzioni nel mondo dei notebook sottili con grande autonomia
Recensione DJI Mini 5 Pro: il drone C0 ultra-leggero con sensore da 1 pollice
Recensione DJI Mini 5 Pro: il drone C0 ultra-leggero con sensore da 1 pollice
DJI Mini 5 Pro porta nella serie Mini il primo sensore CMOS da 1 pollice, unendo qualità d'immagine professionale alla portabilità estrema tipica di tutti i prodotti della famiglia. È un drone C0, quindi in un peso estremamente contenuto e che non richiede patentino, propone un gimbal rotabile a 225 gradi, rilevamento ostacoli anche notturno e autonomia fino a 36 minuti. Caratteristiche che rendono il nuovo drone un riferimento per creator e appassionati
ASUS Expertbook PM3: il notebook robusto per le aziende
ASUS Expertbook PM3: il notebook robusto per le aziende
Pensato per le necessità del pubblico d'azienda, ASUS Expertbook PM3 abbina uno chassis particolrmente robusto ad un pannello da 16 pollici di diagonale che avantaggia la produttività personale. Sotto la scocca troviamo un processore AMD Ryzen AI 7 350, che grazie alla certificazione Copilot+ PC permette di sfruttare al meglio l'accelerazione degli ambiti di intelligenza artificiale
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 27-02-2007, 18:16   #1
osvit
Senior Member
 
L'Avatar di osvit
 
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 664
[JSP] richiamare Crystal Reports XI da pagina jsp

Ciao, vorrei visualizzare un report fatto con C.R. XI richiamandolo da una pagina jsp. Ho provato ad utilizzare un file di esempio trova nella cartella d'installazione di C.R. ma non ci capisco molto
Mi date un consiglio?
Grazie

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<HEAD>
<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
session="true"
%>
<%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"%>
<%@ page import="com.crystaldecisions.xml.serialization.*"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>
<%@ page import="javax.servlet.http.HttpServletResponse"%>
<%@ page import="java.io.*"%>
<%
String CLOSED_RPT_ID = "closedreportid";
String RPT_ID = "reportid";
String RPT_SOURCE = "D:\\Progetti\\report\\prova.rpt";

(RPT_SOURCE="D:\\Progetti\\report\\prova.rpt");

//String closeRptID = request.getParameter(CLOSED_RPT_ID);
//String reportID = request.getParameter(RPT_ID);
//String serializedRptSrc = request.getParameter(RPT_SOURCE);
String closeRptID = "closedreportid";
String reportID = "reportid";
String serializedRptSrc = "D:\\Progetti\\WeFid\\online\\wefidWeb\\report\\prova.rpt";

if (closeRptID != null && closeRptID.length() > 0)
{
// Clear the report source in session with the given closedreportid
session.removeAttribute(closeRptID);
}

if (reportID != null && reportID.length() > 0)
{
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setName("htmlpreview");
viewer.setHasRefreshButton(false);
viewer.setHasExportButton(false);
viewer.setHasPrintButton(false);
viewer.setOwnForm(true);
viewer.setOwnPage(true);

if (serializedRptSrc != null && serializedRptSrc.length() > 0)
{
IReportSource reportSource = null;

// Got a seralizedRprtSrc string
// need to deserialize the report source string and pass to viewer
byte[] byteRptSrc = serializedRptSrc.getBytes();
ByteArrayInputStream byteInStream = new ByteArrayInputStream(byteRptSrc);

try
{
XMLObjectSerializer serializer = new XMLObjectSerializer();
SaveOption saveOpt = serializer.getSaveOption();
saveOpt.setExcludeNullObjects(true);
// Enabled since server is ready.
saveOpt.setSkipWritingIdenticalObject(true);

reportSource = (IReportSource)serializer.load(byteInStream);
}
catch (Exception e)
{
e.printStackTrace();
out.write("Error deserializing report source.");
return;
}
finally
{
byteInStream.close();
}
viewer.setReportSource(reportSource);
session.setAttribute(reportID, viewer.getReportSource());
}
else
{
// Try to load report source from session
viewer.setReportSource((IReportSource) session.getAttribute(reportID));
}
viewer.setURI(request.getRequestURI() + "?" + RPT_ID + "=" + reportID);
viewer.processHttpRequest(request, response, application, null);
}
%>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<TITLE></TITLE>
</HEAD>

<BODY>
<P>Place content here.</P>
</BODY>
</html:html>
__________________
Gli immobiliaristi sono bestie che non puzzano, ma dove passano loro non cresce più l'erba...
osvit è offline   Rispondi citando il messaggio o parte di esso
Old 28-02-2007, 10:16   #2
osvit
Senior Member
 
L'Avatar di osvit
 
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 664
up
__________________
Gli immobiliaristi sono bestie che non puzzano, ma dove passano loro non cresce più l'erba...
osvit è offline   Rispondi citando il messaggio o parte di esso
Old 01-03-2007, 22:09   #3
osvit
Senior Member
 
L'Avatar di osvit
 
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 664
up
__________________
Gli immobiliaristi sono bestie che non puzzano, ma dove passano loro non cresce più l'erba...
osvit è offline   Rispondi citando il messaggio o parte di esso
Old 05-03-2007, 16:19   #4
osvit
Senior Member
 
L'Avatar di osvit
 
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 664
up
__________________
Gli immobiliaristi sono bestie che non puzzano, ma dove passano loro non cresce più l'erba...
osvit è offline   Rispondi citando il messaggio o parte di esso
Old 05-03-2007, 18:56   #5
Psylo
Junior Member
 
L'Avatar di Psylo
 
Iscritto dal: Aug 2006
Città: Pescara
Messaggi: 62
[OT]

il tuo avatar mi sta facendo svalvolare....

[/OT]
__________________
"I giganti sembrano tali solo a coloro che vivono in ginocchio.."
Psylo è offline   Rispondi citando il messaggio o parte di esso
Old 05-03-2007, 20:11   #6
DvL^Nemo
Senior Member
 
L'Avatar di DvL^Nemo
 
Iscritto dal: Nov 2001
Città: 100 metri dal mare
Messaggi: 4856
Adesso non sono a lavoro, quindi non ho nulla sottomano, ma domani ti posto qualcosa CRXI e JSP,nel mio caso e' un report che si aggancia ad un database
Ciao !
DvL^Nemo è offline   Rispondi citando il messaggio o parte di esso
Old 06-03-2007, 14:25   #7
osvit
Senior Member
 
L'Avatar di osvit
 
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 664
Quote:
Originariamente inviato da DvL^Nemo Guarda i messaggi
Adesso non sono a lavoro, quindi non ho nulla sottomano, ma domani ti posto qualcosa CRXI e JSP,nel mio caso e' un report che si aggancia ad un database
Ciao !
Ok grazie.
Potresti anche dirmi quali sono i jar da utilizzare? Nella cartella "Program Files\Common Files\Crystal report XI\java\lib" ce ne sono ben 43
__________________
Gli immobiliaristi sono bestie che non puzzano, ma dove passano loro non cresce più l'erba...
osvit è offline   Rispondi citando il messaggio o parte di esso
Old 06-03-2007, 14:32   #8
osvit
Senior Member
 
L'Avatar di osvit
 
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 664
Quote:
Originariamente inviato da Psylo Guarda i messaggi
[OT]

il tuo avatar mi sta facendo svalvolare....

[/OT]
__________________
Gli immobiliaristi sono bestie che non puzzano, ma dove passano loro non cresce più l'erba...
osvit è offline   Rispondi citando il messaggio o parte di esso
Old 06-03-2007, 14:46   #9
DvL^Nemo
Senior Member
 
L'Avatar di DvL^Nemo
 
Iscritto dal: Nov 2001
Città: 100 metri dal mare
Messaggi: 4856
Comunque nel mio caso i passi erano 2 per lanciare il report
1) Servlet che chiama la JSP di accesso al database, passando username, password e altre cose..
2) JSP che richiama il report

Codice:
package xxx.yyyy;

import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.servlet.*;
import javax.servlet.http.*;

import tchn.login.ConnectionHolder;


public class XXX extends HttpServlet {
	
    private final static String connectionURL = Risorse.getConnectionURL();

    //Risorse.getDataString("server_ip")
    private final static String user = "XXX";
    private final static String password = "YYY";
    
    private static final boolean DEBUG = true;

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {		
		
    	RequestDispatcher reqDis=request.getRequestDispatcher("view/jrc_database_logon.jsp");
    	String sUrlDb=request.getParameter("URLDB");
    	String sId=request.getParameter("sId");
    	java.sql.Connection connection=getConnection(request.getSession(),sUrlDb);    	
    	request.setAttribute("conn",connection);
    	request.setAttribute("sId",sId);
    	reqDis.forward(request,response);
    }

	/** Process the HTTP Post request */
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
		
		doGet(request, response);
    }
    
    private Connection getConnection(HttpSession session,String sUrlDb ){
        Connection con=null;
        // Synchronize: Without this two holders might be created for one client
        synchronized (session) {
          // Try getting the connection holder for this client
          ConnectionHolder holder =
            (ConnectionHolder) session.getAttribute("servletapp.connection");

          // Create (and store) a new connection and holder if necessary
          if (holder == null) {
            try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              Connection cn=DriverManager.getConnection(sUrlDb,user,password);
              holder = new ConnectionHolder(cn);
              session.setAttribute("servletapp.connection", holder);
            }
            catch (SQLException e) {
            	e.printStackTrace();
            } catch (ClassNotFoundException e2) {
                e2.printStackTrace();
            }
          }
        }
        con=((ConnectionHolder)session.getAttribute("servletapp.connection")).getConnection();
        return con;
    }
	
}
2) JSP "jrc_database_logon.jsp"

Codice:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@page import="com.crystaldecisions.reports.sdk.*" %>
<%@page import="com.crystaldecisions.sdk.occa.report.reportsource.*" %>
<%@page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
<%@page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@page import="com.crystaldecisions.report.web.viewer.*" %>
<%@page import="java.util.*"%>
<%@page import="java.sql.*"%>

<%

/* 
* Applies to Versions:	XI
* Date Created: February 9, 2005
* Description: This sample opens a report connected to pubs Sample database on
*              MS SQL Server using the Java Reporting Component (JRC) SDK.  
*              The report uses a JDBC connection in the designer.
*              The code passes in the user name and password for the database
*              via a ConnectionInfos object through the CrystalReportViewer.            
* Author: MAE
*/

%>
<%
	java.sql.Connection connection=(java.sql.Connection)request.getAttribute("conn");
	String sId=request.getAttribute("sId").toString();
%>

<%
	//Use the relative path to the report; the physical or full qualified URL cannot
	// be used.
	String reportName = "reports/Report.rpt";
	
	//Database username and password
	String userName = "XXX";
	String password = "YYY";
    
	 try{
		 ReportClientDocument clientDoc = new ReportClientDocument();
		 clientDoc.open(reportName, 0);

		 Object oReportSource = clientDoc.getReportSource();
         session.setAttribute("reportSource", oReportSource);

         ResultSet resultSet = getResultSetFromQuery("SELECT * FROM STAMPA WHERE ID='"+sId+"'",connection,session, ResultSet.TYPE_SCROLL_INSENSITIVE); 
		
    	//Look up existing table in the report to set the datasource for and obtain its alias.  This table must 
    	//have the same schema as the Resultset that is being pushed in at runtime.  The table could be created 
    	//from a Field Definition File, a Command Object, or regular database table.  As long the Resultset
    	//schema has the same field names and types, then the Resultset can be used as the datasource for the table.  
    	String tableAlias = clientDoc.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
    			
    	//Push the Java ResultSet into the report.  This will then be the datasource of the report.
    	clientDoc.getDatabaseController().setDataSource(resultSet, tableAlias , "resultsetTable");
    	
    	//Store the report source in session, will be used by the CrystalReportViewer.
    	session.setAttribute("reportSource", clientDoc.getReportSource());

		CrystalReportViewer oCrystalReportViewer = new CrystalReportViewer(); 
		
		oCrystalReportViewer.setReportSource(clientDoc.getReportSource());
		
		
	    ConnectionInfos oConnectionInfos = new ConnectionInfos();
	    ConnectionInfo oConnectionInfo = new ConnectionInfo();

	    //Set username and password for the report's database
	    oConnectionInfo.setUserName(userName);
	    oConnectionInfo.setPassword(password);

	    //Add object to collection
	    oConnectionInfos.add(oConnectionInfo);

	    session.setAttribute("oConnectionInfos", oConnectionInfos);

	    oCrystalReportViewer.setDatabaseLogonInfos(oConnectionInfos);
		
		//set viewer attributes
		oCrystalReportViewer.setOwnPage(true);
		oCrystalReportViewer.setOwnForm(true);
	  
		//set the CrystalReportViewer print mode
		//oCrystalReportViewer.setPrintMode(CrPrintMode.ACTIVEX);
		oCrystalReportViewer.setPrintMode(CrPrintMode.PDF);
		  
        oCrystalReportViewer.setDisplayGroupTree(false);
        
		Fields oFields = new Fields();		 
	    //setDiscreteParameterValue(oFields, "sessionId", reportName, sessionId);

	    //Push Fields collection into session so it can be retrieved by the viewer and set
	    //at view time.
	    oCrystalReportViewer.setParameterFields(oFields); 

		session.setAttribute("parameterFields", oFields);  
		
		oCrystalReportViewer.setSeparatePages(true);
		
		oCrystalReportViewer.refresh();
		session.setAttribute("refreshed", "true");
	

	    oCrystalReportViewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null); 	 
		 
	}
	catch(Exception e){
		out.print(e);
	}
%>
<%!
/*
 * Utility function to set values for the discrete parameters in the report.  The report parameter value is set
 * and added to the Fields collection, which can then be passed to the viewer so that the user is not prompted
 * for parameter values.  
 */
private void setDiscreteParameterValue(Fields oFields, String paramName, String reportName, Object value) {
	
	//Create a ParameterField object for each field that you wish to set.  
    ParameterField oParameterField = new ParameterField();

    //You must set the report name. 
    //Set the report name to an empty string if your report does not contain a
    //subreport; otherwise, the report name will be the name of the subreport
    oParameterField.setReportName(reportName);

    //Create a Values object and a ParameterFieldDiscreteValue object for each 
    //object for each parameter field you wish to set.
    //If a ranged value is being set, a ParameterFieldRangeValue object should 
    //be used instead of the discrete value object.
    Values oValues = new Values();
    ParameterFieldDiscreteValue oParameterFieldDiscreteValue = new ParameterFieldDiscreteValue();
    
    //Set the name of the parameter.  This must match the name of the parameter as defined in the
    //report.
    oParameterField.setName(paramName);
    oParameterFieldDiscreteValue.setValue(value);

    //Add the parameter field values to the Values collection object.
    oValues.add(oParameterFieldDiscreteValue);

    //Set the current Values collection for each parameter field.
    oParameterField.setCurrentValues(oValues);

    //Add parameter field to the Fields collection.  This object is then passed to the
    //viewer as the collection of parameter fields values set. 
    oFields.add(oParameterField);
        
}
%>
<%!
	/**
	 * Simple utility function for obtaining result sets that will be pushed into the report.  
	 * This is just standard querying of a Java result set and does NOT involve any 
	 * Crystal JRC SDK functions.  
	 */
	private static ResultSet getResultSetFromQuery(String query,java.sql.Connection connection,HttpSession session, int scrollType) throws SQLException, ClassNotFoundException {

		//Load JDBC driver for the database that will be queried.  
//		Class.forName("oracle.jdbc.driver.OracleDriver");
		
		//Construct JDBC connection.
//		final String DBUSERNAME = "XXX";
//		final String DBPASSWORD = "YYY";
//		final String CONNECTION_URL = "jdbc:oracle:thin:@127.0.0.1:1521:PIPPO";
		
//		java.sql.Connection connection = DriverManager.getConnection(CONNECTION_URL, DBUSERNAME, DBPASSWORD); 
		//java.sql.Connection connection =((tchn.login.ConnectionHolder)session.getAttribute("servletapp.connection")).getConnection();
		java.sql.Statement statement = connection.createStatement(scrollType, ResultSet.CONCUR_READ_ONLY);
		
		//Execute query and return result sets.
		return statement.executeQuery(query);

	}
%>
Modifica il tutto per quello che serve a te ovviamente, dovrebbe andare..

Questi sono tutti i jar che mi ritrovo nella cartella lib, alcuni non sono di Crystal Report..

Codice:
Concurrent.jar
CRDBJavaServerCommon.jar
CRDBXMLServer.jar
CrystalCharting.jar
CrystalCommon.jar
CrystalContentModels.jar
CrystalExporters.jar
CrystalExportingBase.jar
CrystalFormulas.jar
CrystalQueryEngine.jar
CrystalReportEngine.jar
CrystalReportingCommon.jar
icu4j.jar
jrcerom.jar
keycodeDecoder.jar
log4j.jar
MetafileRenderer.jar
ojdbc14.jar
ORACLE7JDBC-JDK1.2.jar
rascore.jar
reportviewerbean.jar
rpoifs.jar
serialization.jar
StringUtil.jar
URIUtil.jar
webreporting.jar
xercesImpl.jar
xml-apis.jar
Ciao !

Ultima modifica di DvL^Nemo : 06-03-2007 alle 14:54.
DvL^Nemo è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Qualcomm Snapdragon X2 Elite: l'architettura del SoC per i notebook del 2026 Qualcomm Snapdragon X2 Elite: l'architettura del...
Recensione DJI Mini 5 Pro: il drone C0 ultra-leggero con sensore da 1 pollice Recensione DJI Mini 5 Pro: il drone C0 ultra-leg...
ASUS Expertbook PM3: il notebook robusto per le aziende ASUS Expertbook PM3: il notebook robusto per le ...
Test ride con Gowow Ori: elettrico e off-road vanno incredibilmente d'accordo Test ride con Gowow Ori: elettrico e off-road va...
Recensione OnePlus 15: potenza da vendere e batteria enorme dentro un nuovo design   Recensione OnePlus 15: potenza da vendere e batt...
La NASA mostra le nuove immagini della c...
Superati 13.300 MT/s per DDR5: ad ASUS e...
L’evoluzione dell’IA nelle imprese: la v...
Le storie in evidenza di Instagram torna...
Addio GeForce RTX 5060 e Radeon RX 9060?...
Arriva Hisense Déco TV S5Q, estet...
Aggiornata TOP500, la classifica degli H...
Noctua NH-D15 Chromax.black è rea...
NVIDIA aggiorna DGX Spark: nuovo kernel,...
Con Work IQ, Copilot per Microsoft 365 i...
Azure Cobalt 200: svelata la nuova CPU A...
Intel a tutto tondo: tra processi in ram...
AMD FSR Redstone arriverà ufficia...
L'Olanda 'cede' alla Cina: retromarcia t...
Stagione 1 al via: tutte le novità...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 22:20.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v