Piccola premessa, ho il report già fatto con tutte le variabili messe bene, non riesco pero a far stampare gli oggetti contenuti in una List. Uso Jasper Reports, faccio un esempio pratico.
Ho una lista di oggetti Persona, un action deve andare nella pagina di stampa del pdf tutti gli oggetti Persona contenuti nella lista. Se ad esempio un'istanza di Persona mi genera due pagine di report, 10 istanze dovrebbero generarmi 20 pagine di report...ora mi genera il report di una singola istanza ._.
Come si fa?
Nella documentazione di JR l'argomento viene trattato cosi:
JasperReports support various types of data sources using a special interface called JRDataSource. There is a default implementation of this interface, the JRResultSetDataSource class, which wraps a java.sql.ResultSet object. It allows the use of any relational database through JDBC. When using a JDBC data source, you could pass a java.sql.Connection object to the report filling operations and specify the query in the report definition itself (see the <queryString> element in the XML file) or could create a new instance of the JRResultSetDataSource by supplying the java.sql.ResultSet object directly. With other types of data sources, things should not be different and all you have to do is to implement the JRDataSource interface, or use one of the implemetations that are shipped with the JasperReports library to wrap in-memory collections or arrays of JavaBeans, CSV or XML files, etc.
sono nuovo nel progetto e mi hanno dato da fare questi report che non li avevo mai visti in vita mia!:berto:
Grazie a chi mi salverà!![]()

Rispondi quotando