Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
JasperReports 3.5 for Java Developers

You're reading from  JasperReports 3.5 for Java Developers

Product type Book
Published in Aug 2009
Publisher Packt
ISBN-13 9781847198082
Pages 368 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

JasperReports 3.5 for Java Developers
Credits
About the Author
About the Reviewers
Preface
1. An Overview of JasperReports 2. Adding Reporting Capabilities to our Java Applications 3. Creating your First Report 4. Creating Dynamic Reports from Databases 5. Working with Other Datasources 6. Report Layout and Design 7. Adding Charts and Graphics to Reports 8. Other JasperReports Features 9. Exporting to Other Formats 10. Graphical Report Design with iReport 11. Integrating JasperReportswith Other Frameworks Index

CSV datasources


JasperReports allows us to use Comma Separated Value(CSV) files as sources of data for our reports.

We will use the following CSV file to provide data for our report:

tail_num,aircraft_serial,aircraft_model,engine_model

N263Y,T-11,39 ROSCOE TRNR RACER,R1830 SERIES

N4087X,BA100-163,BRADLEY AEROBAT,R2800 SERIES

N43JE,HAYABUSA 1,NAKAJIMA KI-43 IIIA,R1830 SERIES

N912S,9973CC,PA18-150,R-1820 SER

The JRDataSource implementation we need to use to create reports from CSV files is called net.sf.jasperreports.engine.data.JRCsvDataSource. The following example demonstrates how to use it:

package net.ensode.jasperbook;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashMap;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}