SlideShare a Scribd company logo
Jasperreports Reporting for Java Developers 1st
Edition David Heffelfinger pdf download
https://ebookfinal.com/download/jasperreports-reporting-for-java-
developers-1st-edition-david-heffelfinger/
Explore and download more ebooks or textbooks
at ebookfinal.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.
Java EE 7 Development with NetBeans 8 3rd Edition David R.
Heffelfinger
https://ebookfinal.com/download/java-ee-7-development-with-
netbeans-8-3rd-edition-david-r-heffelfinger/
Java EE 5 Development using GlassFish Application Server
1st Ed. Edition David R. Heffelfinger
https://ebookfinal.com/download/java-ee-5-development-using-glassfish-
application-server-1st-ed-edition-david-r-heffelfinger/
Learn Objective C for Java Developers 1st Edition James
Bucanek (Auth.)
https://ebookfinal.com/download/learn-objective-c-for-java-
developers-1st-edition-james-bucanek-auth/
Effective Unit Testing A guide for Java Developers 1st
Edition Lasse Koskela
https://ebookfinal.com/download/effective-unit-testing-a-guide-for-
java-developers-1st-edition-lasse-koskela/
Microservices for Java developers a hands on introduction
to frameworks and containers First Edition. Edition Posta
https://ebookfinal.com/download/microservices-for-java-developers-a-
hands-on-introduction-to-frameworks-and-containers-first-edition-
edition-posta/
OSWorkflow A guide for Java developers and architects to
integrating open source Business Process Management 1st
Ed. Edition Naya Lazo
https://ebookfinal.com/download/osworkflow-a-guide-for-java-
developers-and-architects-to-integrating-open-source-business-process-
management-1st-ed-edition-naya-lazo/
Android Boot Camp for Developers Using Java A Guide to
Creating Your First Android Apps Third Edition Corinne
Hoisington
https://ebookfinal.com/download/android-boot-camp-for-developers-
using-java-a-guide-to-creating-your-first-android-apps-third-edition-
corinne-hoisington/
The Definitive Guide to JasperReports 1st Edition Teodor
Danciu
https://ebookfinal.com/download/the-definitive-guide-to-
jasperreports-1st-edition-teodor-danciu/
HTML5 for NET Developers Jim Jackson
https://ebookfinal.com/download/html5-for-net-developers-jim-jackson/
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
Jasperreports Reporting for Java Developers 1st Edition
David Heffelfinger Digital Instant Download
Author(s): David Heffelfinger
ISBN(s): 9781904811909, 1904811906
Edition: 1
File Details: PDF, 9.08 MB
Year: 2006
Language: english
JasperReports
for
Java
Developers
David
R.
Heffelfi
nger
$ 44.99 US
£ 27.99 UK
€ 41.99 EU
Prices do not include
local sales tax or VAT
where applicable
Packt Publishing
Birmingham - Mumbai
www.packtpub.com
JasperReports
for Java Developers
JasperReports is the world’s most popular embeddable open-source Java reporting library,
providing Java developers with the power to easily create rich print and web reports.
This book shows you exactly how to get started, and develop the skills to get the most
from JasperReports.
The book steers you through each point of report setup, from creating, designing, formatting,
and exporting reports with data from a wide range of datasources, to integrating JasperReports
with other Java frameworks.
What you will learn from this book
• What JasperReports is, and what it can do for you
• Adding reporting capabilities to your application
• Creating and formatting reports
• Report layout and design
• Working with database datasources and XML
• Working with Java object datasources
• Adding charts and graphics to a report
• Working with crosstabs, subdatasets, and scriptlets
• Working with the iReport report designer
• Exporting reports to PDF, Excel spreadsheet or Word document format
• Integrating JasperReports with other Java frameworks like Spring, JavaServer Faces,
Struts, and Hibernate
Who this book is written for
This book is for Java developers who want to create rich reports for either the Web or print, and
want to get started quickly with JasperReports to do this. No knowledge of Jasper Reports is
presumed, although familiarity with Java, SQL, and XML is assumed.
F r o m T e c h n o l o g i e s t o S o l u t i o n s
JasperReports
for Java Developers
Create, Design, Format, and Export Reports with the World’s
Most Popular Java Reporting Library
David R. Heffelfinger
JasperReports for
Java Developers
Create, Design, Format, and Export Reports with
the World's Most Popular Java Reporting Library
David R. Heffelfinger
BIRMINGHAM - MUMBAI
JasperReports for Java Developers
Create, Design, Format, and Export Reports with the World's Most
Popular Java Reporting Library
Copyright © 2006 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of
the information presented. However, the information contained in this book is sold
without warranty, either express or implied. Neither the author, Packt Publishing,
nor its dealers or distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2006
Production Reference: 1180706
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 1-904811-90-6
www.packtpub.com
Cover Image by www.visionwt.com
Credits
Author
David R. Heffelfinger
Reviewers
Thomas M. Ose
Meenakshi Singh
Sarosh Khateeb
Development Editor
Douglas Paterson
Assistant Development Editor
Nikhil Bangera
Technical Editor
Priyanka Baruah
Project Manager
Patricia Weir
Editorial Manager
Dipali Chittar
Indexer
Mithil Kulkarni
Proofreader
Chris Smith
Production Coordinator
Manjiri Nadkarni
Layouts and Illustrations
Shantanu Zagade
Cover Designer
Manjiri Nadkarni
About the Author
David R. Heffelfinger has been developing software professionally since 1995;
he has been using Java as his primary programming language since 1996. He has
worked on many large-scale projects for several clients including Freddie Mac,
Fannie Mae, and the US Department of Defense. He has a Masters degree in
Software Engineering from Southern Methodist University. David is editor in chief
of Ensode.net (http://www.ensode.net ), a website about Java, Linux, and other
technology topics.
I would like to thank everyone at Packt Publishing, particularly
Douglas Paterson, Patricia Weir, Nikhil Bangera, and Priyanka Baruah,
and the technical reviewer, Thomas Ose. This book wouldn't have been
a reality without your help. I would especially like to thank my family
for their support.
A special dedication goes to my wife and daughter.
Table of Contents
Preface 1
Chapter 1: An Overview of JasperReports 7
Brief History of JasperReports 7
What is JasperReports? 8
The JasperReports Open-Source License 9
Features of JasperReports 9
Flexible Report Layout 9
Multiple Ways to Present Data 10
Multiple Ways to Supply Data 10
Multiple Datasources 10
Watermarks 10
Subreports 11
Exporting Capabilities 11
Class Library Dependencies 13
Typical Workflow 13
Where to Get Help? 16
Summary 17
Chapter 2: Adding Reporting Capabilities to Java Applications 19
Downloading JasperReports 19
Setting Up Our Environment 22
JasperReports Class Library 23
Required Libraries for Report Compilation 23
Jakarta Commons 24
Optional Libraries and Tools 25
Apache ANT 25
JDT Compiler 26
JDBC Driver 26
Table of Contents
[ ii ]
iText 27
JFreeChart 27
Jakarta POI 27
Summary 28
Chapter 3: Creating Your First Report 29
Creating a JRXML Report Template 29
Previewing the XML Report Template 30
Creating a Binary Report Template 33
Compiling a JRXML Template Programmatically 33
Compiling a JRXML Template through ANT 36
Generating the Report 38
Viewing the Report 40
Displaying Reports on a Web Browser 43
Elements of a JRXML Report Template 45
<property> 46
<import> 46
<reportFont> 46
<parameter> 47
<queryString> 47
<field> 47
<variable> 47
<group> 48
<background> 48
<title> 48
<pageHeader> 49
<columnHeader> 49
<detail> 50
<columnFooter> 50
<pageFooter> 51
<lastPageFooter> 51
<summary> 52
Summary 54
Chapter 4: Creating Dynamic Database Reports 55
Database for Our Reports 55
Generating Database Reports 57
Embedding SQL Queries into a Report Template 57
Generating the Report 60
Modifying a Report Query via Report Parameters 65
Database Reporting via a Datasource 70
Database Report Methods Compared 76
Table of Contents
[ iii ]
Summary 77
Chapter 5: Working with Other Datasources 79
Empty Datasources 80
Map Datasources 87
Java Objects as Datasources 92
TableModels as Datasources 99
XML as Datasource 105
Custom Datasources 109
Writing a Custom JRDataSource Implementation 110
Using the Custom JRDataSource Implementation 113
Summary 114
Chapter 6: Report Layout and Design 115
Controlling Report-Wide Layout Properties 116
Setting Text Properties 117
Styles 117
Setting Text Style for Individual Report Elements 120
Setting Styles for Text Segments 121
Setting a Report's Background 122
Adding Multiple Columns to a Report 125
A Few Things about Report Columns 128
Grouping Report Data 129
Report Expressions 133
Report Variables 137
Built-In Report Variables 146
Stretching Text Fields to Accommodate Data 146
Laying Out Report Elements 149
Setting the Size and Position of a Report Element 152
Using the <frame> Element 157
Hiding Repeated Values 158
Subreports 162
Summary 168
Chapter 7: Adding Charts and Graphics to Reports 169
Adding Geometrical Shapes to a Report 169
Adding Lines to a Report 169
Adding Rectangles to a Report 171
Adding Ellipses to a Report 172
Table of Contents
[ iv ]
Adding Images to a Report 173
Attributes of the <image> Element 175
evaluationTime 175
evaluationGroup 175
hAlign 175
vAlign 176
isLazy 176
isUsingCache 176
onErrorType 176
Adding Charts to a Report 177
Attributes of the <chart> Element 177
customizerClass 177
evaluationGroup 177
evaluationTime 177
isShowLegend 178
Chart Customization 178
Chart Datasets 179
Attributes of the <dataset> Element 179
Plotting Charts 180
Attributes of the <plot> Element 180
Pie Charts 181
Bar Charts 184
XY Line Charts 187
Other Types of Charts 190
Summary 190
Chapter 8: Other JasperReports Features 191
Report Localization 191
Scriptlets 194
Crosstabs 200
<columnGroup> 204
<crosstabCell> 204
<crosstabDataset> 204
<crosstabParameter> 204
<measure> 204
<parametersMapExpression> 205
<reportElement> 205
<rowGroup> 205
<whenNoDataCell> 205
Subdatasets 205
Adding Hyperlinks and Anchors to Reports 212
Bookmarks 215
Handling Very Large Reports 218
Table of Contents
[  ]
Summary 220
Chapter 9: Exporting to Other Formats 221
Exporting Overview 221
Exporting to PDF 223
Exporting to RTF 225
Exporting to Excel 227
Exporting to HTML 229
Exporting to XML 231
Exporting to CSV 234
Exporting to Plain Text 237
Directing HTML Reports to a Browser 240
Summary 246
Chapter 10: Graphical Report Design with iReport 247
Obtaining iReport 248
Setting Up iReport 249
Creating a Database Report in Record Time 254
Creating a Report From Scratch 263
Creating More Elaborate Reports 273
Adding Images to a Report 274
Adding Multiple Columns to a Report 275
Grouping Report Data 278
Adding Charts to a Report 282
Help and Support 288
Summary 288
Chapter 11: Integrating JasperReports with other Frameworks 289
Integrating JasperReports with Hibernate 289
Integrating JasperReports with Spring 303
Integrating JasperReports with JavaServer Faces 309
Integrating JasperReports with Struts 314
Summary 320
Index 321
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
Preface
JasperReports was started by Teodor Danciu, in 2001, when he was faced with the
task of evaluating reporting tools for a project he was working on. The existing
solutions that he found were too expensive for his project's budget. Therefore, he
decided to write his own reporting tool, JasperReports, which has now become
immensely popular, and is currently one of the most popular (if not the most
popular) Java reporting tool available.
JasperReports is an open-source Java class library designed to aid developers with the
task of adding reporting capabilities to Java applications by providing an API to facilitate
the ability to generate reports from any kind of Java application. Though primarily
used to add reporting capabilities to web-based applications, it can also be used to create
standalone desktop or command-line Java applications for report generation.
This book steers you through each point of report setup, to creating, designing,
formatting, and exporting reports with data from a wide range of datasources, and
integrating JasperReports with other Java frameworks.
What This Book Covers
Chapter 1 covers JasperReports' history, and its features and gives us an overview of
the steps involved in generating reports using JasperReports.
Chapter 2 shows us how to embed JasperReports into client and server-side Java
applications. We will install JasperReports and learn how to identify and install
required libraries. We will also see how to set up our development and execution
environment to add reporting capabilities to Java applications.
In Chapter 3, we create our first static JasperReports both programmatically and
by using the ANT tool. We will see how to work with JRXML and binary report
templates to generate reports in JasperReports' native format. We will then learn
how to view these reports.
Preface
[  ]
In Chapter 4, we learn how to create dynamic reports. We will do this by embedding
SQL queries in the JRXML report template, or by passing the database data to the
compiled report via a datasource.
In Chapter 5, we cover how to use datasources other than databases to create reports.
Specifically, we will learn to create reports from empty datasources, Java objects,
TableModels, XML data, and also from our custom-created datasources.
In Chapter 6, we cover how to create elaborate layouts for our reports by adding
background images or text to a report, logically grouping report data, conditionally
printing report data, and creating subreports.
In Chapter 7, we cover how to take advantage of JasperReports' graphical features
and create reports with graphical data like geometric shapes, images, and 2-D and
3-D charts.
Chapter 8 discusses advanced JasperReports' features like creating crosstab (cross-
tabulation) reports and adding anchors, hyperlinks, and bookmarks. We then see
how to work with subdatasets and how to execute snippets of Java code by using
scriptlets. This chapter also shows how to display report text in different languages.
In Chapter 9, we cover how to export our reports to all formats supported by
JasperReports; these include PDF, RTF, Excel, HTML, CSV, XML, and plain text. We
also see how to direct exported reports to a browser.
Chapter 10 covers iReport, which is a report designer that can help us visually
generate JRXML templates. This chapter shows how to install and get started with
iReport. iReport can be used to do everything that we have covered so far in this
book and this chapter shows us how.
Chapter 11 covers the integration of JasperReports with three of the most popular
Java web application frameworks around—Spring Web MVC, JavaServer Faces, and
Struts. We shall also see how to generate reports with data obtained using Hibernate,
which is a popular Java Object Relational Mapping tool.
What You Need for This Book
To use this book, you will of course need JasperReports. This is freely downloadable
from http://www.sourceforge.net/projects/jasperreports.
JasperReports has its own requirements for proper and successful functioning: Java
Development Kit (JDK) 1.4 or newer (http://java.sun.com/javase/downloads/
index.jsp), ANT 1.6 or newer (http://ant.apache.org/), iReport 1.2 or newer
(http://ireport.sourceforge.net/). Any operating system supporting Java can
be used (any modern version of Microsoft Windows, Mac OS X, Linux, or Solaris).
Preface
[  ]
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
There are three styles for code. Code words in text are shown as follows: All JRXML
files contain a jasperReport root element that can contain many sub-elements.
A block of code will be set as follows:
package net.ensode.jasperbook;
import java.util.HashMap;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items will be made bold:
detail
band height=20
staticText
reportElement x=20 y=0 width=200 height=20/
text![CDATA[If you don't see this, it didn't work]]/text
/staticText
/band
/detail
Any command-line input and output is written as follows:
$ ant
New terms and important words are introduced in a bold-type font. Words that you
see on the screen, in menus or dialog boxes for example, appear in our text like this:
clicking the Next button moves you to the next screen.
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Preface
[  ]
Reader Feedback
Feedback from our readers is always welcome. Let us know what you think about
this book, what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to feedback@packtpub.com,
making sure to mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please send us a
note in the SUGGEST A TITLE form on www.packtpub.com or email suggest@
packtpub.com.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer Support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Downloading the Example Code for the Book
Visit http://www.packtpub.com/support, and select this book from the list of titles
to download any example code or extra resources for this book. The files available
for download will then be displayed.
The downloadable files contain instructions on how to
use them.
Errata
Although we have taken every care to ensure the accuracy of our contents, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in text or
code—we would be grateful if you would report this to us. By doing this you can
save other readers from frustration, and help to improve subsequent versions of this
book. If you find any errata, report them by visiting http://www.packtpub.com/
support, selecting your book, clicking on the Submit Errata link, and entering the
details of your errata. Once your errata have been verified, your submission will be
accepted and the errata added to the list of existing errata. The existing errata can be
viewed by selecting your title from http://www.packtpub.com/support.
Preface
[  ]
Questions
You can contact us at questions@packtpub.com if you are having a problem with
some aspect of the book, and we will do our best to address it.
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
An Overview of JasperReports
This chapter presents an overview of JasperReports and explains its capabilities and
features. Here is a brief outline of the topics covered in this chapter:
A brief history of JasperReports
What JasperReports is, and what it can do for us
A brief discussion of the JasperReports open-source license
The features of JasperReports
JasperReports' class library dependencies
A brief overview of the steps required to generate reports with JasperReports
Where to get support for JasperReports
Brief History of JasperReports
JasperReports was started by Teodor Danciu, in 2001, when he was faced with the
task of evaluating reporting tools for a project he was working on. The existing
solutions that he found were too expensive for his project's budget. Therefore, he
decided to write his own reporting tool. The project for which he was evaluating
reporting tools got canceled; but, nevertheless, he started working on JasperReports
in his spare time. He registered the project on http://sourceforge.net in
September, 2001. Shortly after, he started getting emails from interested potential
users even though he had not yet released any code.
JasperReports version 0.1.5 was released in November, 2001. Since then,
JasperReports has become immensely popular, and is currently one of the most
popular (if not the most popular) Java reporting tools available. As a testament to
JasperReports' enormous popularity, a Google search for java reporting tool returns
the JasperReports website as its first result.
•
•
•
•
•
•
•
An Overview of JasperReports
[  ]
Until recently, JasperReports was basically a one-man project, with Teodor working
on it in his spare time. In April 2005, a company called JasperSoft was formally
launched at the MySQL User Conference in California. JasperSoft sponsors
JasperReports' development, allowing Teodor and other JasperSoft developers to work
full-time on JasperReports. JasperSoft also provides commercial support and services
for JasperReports and related products, including the iReport Visual Designer
for JasperReports. In addition to providing support for JasperReports and iReport,
JasperSoft sells commercial applications incorporating JasperReports.
JasperSoft has raised over 8 million dollars in venture capital funding, no small feat in
these post-dotcom days. This investment is a clear indication that venture capitalists
have confidence in the success of JasperSoft, and, by extension, in the success of
JasperReports. According to JasperSoft, JasperReports has been downloaded over
300,000 times, and gets over 20,000 downloads a month. It has been deployed in over
10,000 companies and Independent Software Vendors (ISVs).
What is JasperReports?
JasperReports is an open-source Java class library designed to aid developers
with the task of adding reporting capabilities to Java applications. Since it is not a
standalone tool, it cannot be installed on its own. Instead, it is embedded into Java
applications by including its library in the application's CLASSPATH. JasperReports
is a Java class library, and is not meant for end users, but rather is targeted towards
Java developers who need to add reporting capabilities to their applications.
Although JasperReports is primarily used to add reporting capabilities to web-based
applications via the Servlet API, it has absolutely no dependencies on the Servlet API
or any other Java EE library. It is, therefore, by no means limited to web applications.
There is nothing stopping us from creating standalone desktop or command-line
Java applications to generate reports with JasperReports. After all, JasperReports is
nothing but a Java class library providing an API to facilitate the ability to generate
reports from any kind of Java application.
JasperReports requires a Java Development Kit (JDK) 1.3 or newer in order to
successfully compile applications incorporating the JasperReports Java class
library, and a Java Runtime Environment 1.3 or newer to successfully execute
these applications. Older versions of JasperReports required a JDK to successfully
execute JasperReports applications (strictly speaking, JasperReports required
tools.jar to be in the CLASSPATH, and tools.jar is included in the JDK, not the
JRE). However, from version 0.6.4, JasperReports is bundled with the Eclipse Java
Development Tools (JDT) compiler, and no longer needs a JDK to execute deployed
applications. Examples in this book are developed using JDK 1.5, but should compile
and execute successfully with any JDK or JRE supported by JasperReports.
Chapter 1
[  ]
The JasperReports Open-Source License
JasperReports is licensed under the Lesser GNU Public License (LGPL). This license
was chosen for JasperReports since, unlike the GPL, it allows JasperReports to be
used in both open-source and closed-source applications. Applications linking to
the JasperReports Java class library do not need to be open-source. However, if you
consider making modifications to the existing JasperReports source code, then your
modifications will have to be released under the LGPL. See http://jasperreports.
sourceforge.net/license.html for the complete license.
Features of JasperReports
In addition to textual data, JasperReports is capable of generating professional
reports including images, charts, and graphs. Some of the major JasperReports
features include:
It has flexible report layout.
It is capable of presenting data textually or graphically.
It allows developers to supply data in multiple ways.
It can accept data from multiple datasources.
It can generate watermarks.
It can generate subreports.
It is capable of exporting reports to a variety of formats.
Each of these features is briefly described in the next few sections.
Flexible Report Layout
JasperReports allows us to separate data into optional report sections.
These sections include:
The report title, which will appear once at the top of the report.
A page header, which will appear at the top of every page.
A detail section, which typically contains the primary report data.
A page footer, which will appear at the bottom of every page.
A summary section, which will appear at the end of the report.
All of these and other report sections are discussed in detail in Chapter 6. In
addition to allowing us to define report sections, JasperReports allows the creation
of elaborate dynamic layouts based on the contents of the report. For example,
depending on the value of a report field, data can be hidden or displayed in a report,
•
•
•
•
•
•
•
•
•
•
•
•
Discovering Diverse Content Through
Random Scribd Documents
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
The Project Gutenberg eBook of The Works of
John Dryden, now first collected in eighteen
volumes. Volume 14
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Title: The Works of John Dryden, now first collected in eighteen
volumes. Volume 14
Author: John Dryden
Release date: January 19, 2021 [eBook #64337]
Most recently updated: October 18, 2024
Language: English
Credits: Jonathan Ingram, Matthias Grammel and the Online
Distributed Proofreading Team at
https://www.pgdp.net
*** START OF THE PROJECT GUTENBERG EBOOK THE WORKS OF
JOHN DRYDEN, NOW FIRST COLLECTED IN EIGHTEEN VOLUMES.
VOLUME 14 ***
THE
WORKS
OF
JOHN DRYDEN
VOL. XIV.
THE
WORKS
OF
JOHN DRYDEN,
NOW FIRST COLLECTED
IN EIGHTEEN VOLUMES.
ILLUSTRATED
WITH NOTES,
HISTORICAL, CRITICAL, AND EXPLANATORY,
AND
A LIFE OF THE AUTHOR,
BY
WALTER SCOTT, Esq.
VOL. XIV.
LONDON:
PRINTED FOR WILLIAM MILLER, ALBEMARLE STREET
BY JAMES BALLANTYNE AND CO. EDINBURGH.
1808.
CONTENTS
OF
VOLUME FOURTEENTH.
PAGE.
The Georgics, translated from Virgil 1
Dedication to the Earl of Chesterfield 3
An Essay on the Georgics, by Mr Addison 14
Book I. 27
Book II. 49
Book III. 73
Book IV. 98
Notes on Book IV. 123
Æneis 125
Dedication to the Marquis of Normanby,
Earl of Mulgrave, c. 127
Book I. 231
Notes on Book I. 262
Book II. 264
Book III. 296
Notes on Book III. 323
Book IV. 324
Note on Book IV. 353
Æneis, Book V. 355
Book VI. 388
Notes on Book VI. 424
Book VII. 429
Notes on Book VII. 461
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
THE GEORGICS.
TO
THE RIGHT HONOURABLE
PHILIP,
EARL OF CHESTERFIELD, c.[1]
MY LORD,
I cannot begin my address to your lordship better than in the words
of Virgil:
----Quod optanti divûm promittere nemo
Auderet, volvenda dies, en, attulit ultro.
Seven years together I have concealed the longing which I had to
appear before you: a time as tedious as Æneas passed in his
wandering voyage, before he reached the promised Italy. But I
considered, that nothing which my meanness could produce, was
worthy of your patronage. At last this happy occasion offered, of
presenting to you the best poem of the best poet. If I balked this
opportunity, I was in despair of finding such another; and, if I took
it, I was still uncertain whether you would vouchsafe to accept it
from my hands. It was a bold venture which I made, in desiring your
permission to lay my unworthy labours at your feet. But my rashness
has succeeded beyond my hopes; and you have been pleased not to
suffer an old man to go discontented out of the world, for want of
that protection, of which he had been so long ambitious. I have
known a gentleman in disgrace, and not daring to appear before
King Charles the Second, though he much desired it: at length he
took the confidence to attend a fair lady to the court, and told his
majesty, that, under her protection, he had presumed to wait on
him. With the same humble confidence, I present myself before your
lordship, and, attending on Virgil, hope a gracious reception. The
gentleman succeeded, because the powerful lady was his friend; but
I have too much injured my great author, to expect he should
intercede for me. I would have translated him; but, according to the
literal French and Italian phrases, I fear I have traduced him. It is
the fault of many a well-meaning man, to be officious in a wrong
place, and do a prejudice where he had endeavoured to do a
service. Virgil wrote his Georgics in the full strength and vigour of his
age, when his judgment was at the height, and before his fancy was
declining. He had (according to our homely saying) his full swing at
this poem, beginning it about the age of thirty-five, and scarce
concluding it before he arrived at forty. It is observed, both of him
and Horace, (and I believe it will hold in all great poets,) that,
though they wrote before with a certain heat of genius which
inspired them, yet that heat was not perfectly digested. There is
required a continuance of warmth, to ripen the best and noblest
fruits. Thus Horace, in his First and Second Book of Odes, was still
rising, but came not to his meridian till the Third; after which, his
judgment was an overpoise to his imagination: he grew too cautious
to be bold enough; for he descended in his Fourth by slow degrees,
and, in his Satires and Epistles, was more a philosopher and a critic
than a poet. In the beginning of summer, the days are almost at a
stand, with little variation of length or shortness, because at that
time the diurnal motion of the sun partakes more of a right line than
of a spiral. The same is the method of nature in the frame of man.
He seems at forty to be fully in his summer tropic; somewhat before,
and somewhat after, he finds in his soul but small increases or
decays. From fifty to three score, the balance generally holds even,
in our colder climates: for he loses not much in fancy; and
judgement, which is the effect of observation, still increases. His
succeeding years afford him little more than the stubble of his own
harvest: yet, if his constitution be healthful, his mind may still retain
a decent vigour; and the gleanings of that Ephraim, in comparison
with others, will surpass the vintage of Abiezer. I have called this
somewhere, by a bold metaphor, a green old age; but Virgil has
given me his authority for the figure—
Jam senior; sed cruda Deo, viridisque
senectus.
Among those few who enjoy the advantage of a latter spring, your
lordship is a rare example; who, being now arrived at your great
climacteric, yet give no proof of the least decay of your excellent
judgment and comprehension of all things which are within the
compass of human understanding. Your conversation is as easy as it
is instructive; and I could never observe the least vanity, or the least
assuming, in any thing you said, but a natural unaffected modesty,
full of good sense, and well digested; a clearness of notion,
expressed in ready and unstudied words. No man has complained,
or even can, that you have discoursed too long on any subject; for
you leave us in an eagerness of learning more; pleased with what
we hear, but not satisfied, because you will not speak so much as we
could wish. I dare not excuse your lordship from this fault; for,
though it is none in you, it is one to all who have the happiness of
being known to you. I must confess, the critics make it one of Virgil's
beauties, that, having said what he thought convenient, he always
left somewhat for the imagination of his readers to supply; that they
might gratify their fancies, by finding more in what he had written,
than at first they could; and think they had added to his thought,
when it was all there before-hand, and he only saved himself the
expence of words. However it was, I never went from your lordship,
but with a longing to return, or without a hearty curse to him who
invented ceremonies in the world, and put me on the necessity of
withdrawing, when it was my interest, as well as my desire, to have
given you a much longer trouble. I cannot imagine, (if your lordship
will give me leave to speak my thoughts,) but you have had a more
than ordinary vigour in your youth; for too much of heat is required
at first, that there may not too little be left at last. A prodigal fire is
only capable of large remains; and yours, my lord, still burns the
clearer in declining. The blaze is not so fierce as at the first; but the
smoke is wholly vanished; and your friends, who stand about you,
are not only sensible of a cheerful warmth, but are kept at an awful
distance by its force. In my small observations of mankind, I have
ever found, that such as are not rather too full of spirit when they
are young, degenerate to dulness in their age. Sobriety in our riper
years is the effect of a well-concocted warmth: but, where the
principles are only phlegm, what can be expected from the waterish
matter, but an insipid manhood, and a stupid old infancy—discretion
in leading-strings, and a confirmed ignorance on crutches? Virgil, in
his Third Georgic, when he describes a colt, who promises a courser
for the race, or for the field of battle, shews him the first to pass the
bridge, which trembles under him, and to stem the torrent of the
flood. His beginnings must be in rashness—a noble fault: but time
and experience will correct that error, and tame it into a deliberate
and well-weighed courage, which knows both to be cautious and to
dare, as occasion offers. Your lordship is a man of honour, not only
so unstained, but so unquestioned, that you are the living standard
of that heroic virtue; so truly such, that if I would flatter you, I could
not. It takes not from you, that you were born with principles of
generosity and probity; but it adds to you, that you have cultivated
nature, and made those principles the rule and measure of all your
actions. The world knows this, without my telling; yet poets have a
right of recording it to all posterity:
Dignum laude virum Musa vetat mori.
Epaminondas, Lucullus, and the two first Cæsars, were not
esteemed the worse commanders, for having made philosophy and
the liberal arts their study. Cicero might have been their equal, but
that he wanted courage. To have both these virtues, and to have
improved them both with a softness of manners and a sweetness of
conversation—few of our nobility can fill that character. One there is,
and so conspicuous by his own light, that he needs not
Digito monstrari, et dicier, Hic est!
To be nobly born, and of an ancient family, is in the extremes of
fortune, either good or bad; for virtue and descent are no
inheritance. A long series of ancestors shews the native with great
advantage at the first; but, if he any way degenerate from his line,
the least spot is visible on ermine. But, to preserve this whiteness in
its original purity, you, my lord, have, like that ermine, forsaken the
common tract of business, which is not always clean: you have
chosen for yourself a private greatness, and will not be polluted with
ambition. It has been observed in former times, that none have
been so greedy of employments, and of managing the public, as
they who have least deserved their stations. But such only merit to
be called patriots, under whom we see their country flourish. I have
laughed sometimes, (for who would always be a Heraclitus?) when I
have reflected on those men, who from time to time have shot
themselves into the world. I have seen many successions of them;
some bolting out upon the stage with vast applause, and others
hissed off, and quitting it with disgrace. But, while they were in
action, I have constantly observed, that they seemed desirous to
retreat from business; greatness, they said, was nauseous, and a
crowd was troublesome: a quiet privacy was their ambition. Some
few of them, I believe, said this in earnest, and were making a
provision against future want, that they might enjoy their age with
ease. They saw the happiness of a private life, and promised to
themselves a blessing, which every day it was in their power to
possess. But they deferred it, and lingered still at court, because
they thought they had not yet enough to make them happy: they
would have more, and laid in, to make their solitude luxurious:—a
wretched philosophy, which Epicurus never taught them in his
garden. They loved the prospect of this quiet in reversion, but were
not willing to have it in possession: they would first be old, and
make as sure of health and life, as if both of them were at their
dispose. But put them to the necessity of a present choice, and they
preferred continuance in power; like the wretch who called Death to
his assistance, but refused him when he came. The great Scipio was
not of their opinion, who indeed sought honours in his youth, and
endured the fatigues with which he purchased them. He served his
country when it was in need of his courage and conduct, till he
thought it was time to serve himself; but dismounted from the
saddle when he found the beast which bore him began to grow
restiff and ungovernable. But your lordship has given us a better
example of moderation. You saw betimes, that ingratitude is not
confined to commonwealths; and therefore, though you were
formed alike for the greatest of civil employments and military
commands, yet you pushed not your fortune to rise in either, but
contented yourself with being capable, as much as any whosoever of
defending your country with your sword, or assisting it with your
counsel, when you were called.[2] For the rest, the respect and love
which was paid you, not only in the province where you live, but
generally by all who had the happiness to know you, was a wise
exchange for the honours of the court—a place of forgetfulness, at
the best, for well-deservers. It is necessary, for the polishing of
manners, to have breathed that air; but it is infectious, even to the
best morals, to live always in it. It is a dangerous commerce, where
an honest man is sure at the first of being cheated, and he recovers
not his loses, but by learning to cheat others. The undermining smile
becomes at length habitual; and the drift of his plausible
conversation is only to flatter one, that he may betray another. Yet it
is good to have been a looker on, without venturing to play; that a
man may know false dice another time, though he never means to
use them. I commend not him who never knew a court, but him who
forsakes it because he knows it. A young man deserves no praise,
who, out of melancholy zeal, leaves the world before he has well
tried it, and runs headlong into religion. He who carries a
maidenhead into a cloister, is sometimes apt to lose it there, and to
repent of his repentance. He only is like to endure austerities, who
has already found the inconvenience of pleasures: for almost every
man will be making experiments in one part or another of his life;
and the danger is the less when we are young; for, having tried it
early, we shall not be apt to repeat it afterwards. Your lordship
therefore may properly be said to have chosen a retreat, and not to
have chosen it till you had maturely weighed the advantages of
rising higher, with the hazards of the fall.
Res, non parta labore, sed relicta,
was thought by a poet to be one of the requisites to a happy life.
Why should a reasonable man put it into the power of Fortune to
make him miserable, when his ancestors have taken care to release
him from her? Let him venture, says Horace, qui zonam perdidit. He,
who has nothing, plays securely; for he may win, and cannot be
poorer if he loses: but he who is born to a plentiful estate, and is
ambitious of offices at court, sets a stake to Fortune, which she can
seldom answer. If he gains nothing, he loses all, or part of what was
once his own; and, if he gets, he cannot be certain but he may
refund. In short, however he succeeds, it is covetousness that
induced him first to play; and covetousness is the undoubted sign of
ill sense at bottom. The odds are against him, that he loses; and one
loss may be of more consequence to him than all his former
winnings. It is like the present war of the Christians against the Turk:
every year they gain a victory, and by that a town; but, if they are
once defeated, they lose a province at a blow, and endanger the
safety of the whole empire. You, my lord, enjoy your quiet in a
garden, where you have not only the leisure of thinking, but the
pleasure to think of nothing which can discompose your mind. A
good conscience is a port which is land-locked on every side, and
where no winds can possibly invade, no tempests can arise. There a
man may stand upon the shore, and not only see his own image, but
that of his Maker, clearly reflected from the undisturbed and silent
waters. Reason was intended for a blessing; and such it is to men of
honour and integrity, who desire no more than what they are able to
give themselves; like the happy old Corycian, whom my author
describes in his Fourth Georgic, whose fruits and sallads, on which
he lived contented, were all of his own growth, and his own
plantation. Virgil seems to think, that the blessings of a country-life
are not complete without an improvement of knowledge by
contemplation and reading:
O fortunatos nimium, sua si bona nôrint,
Agricolas!
It is but half possession, not to understand that happiness which we
possess. A foundation of good sense, and a cultivation of learning,
are required to give a seasoning to retirement, and make us taste
the blessing. God has bestowed on your lordship the first of these;
and you have bestowed on yourself the second. Eden was not made
for beasts, though they were suffered to live in it, but for their
master, who studied God in the works of his creation. Neither could
the devil have been happy there with all his knowledge; for he
wanted innocence to make him so. He brought envy, malice, and
ambition, into Paradise, which soured to him the sweetness of the
place. Wherever inordinate affections are, 'tis hell. Such only can
enjoy the country, who are capable of thinking when they are there,
and have left their passions behind them in the town. Then they are
prepared for solitude; and, in that solitude, is prepared for them,
Et secura quies, et nescia fallere vita.
As I began this Dedication with a verse of Virgil, so I conclude it with
another.
The continuance of your health, to enjoy that happiness which you
so well deserve, and which you have provided for yourself, is the
sincere and earnest wish of
Your lordship's
Most devoted
And most obedient servant,
John Dryden.
FOOTNOTES:
[1] Philip Stanhope, second Earl of Chesterfield, born in 1634. He
was a man of considerable talent and political activity; was active
in forwarding the Restoration; and enjoyed at the court of Charles
II. several offices, but was now retired. He died in 1713.
[2] Dryden's praise, though often hyperbolical, is always founded
on some circumstances appropriate to its object. Lord
Chesterfield, who had enjoyed offices of honour at the court of
Charles II., now lived in retirement at an elegant villa, according
to Mr Malone, near Twickenham.
AN
ESSAY
ON
THE GEORGICS.
BY
MR ADDISON.[3]
Virgil may be reckoned the first who introduced three new kinds of
poetry among the Romans, which he copied after three the greatest
masters of Greece. Theocritus and Homer have still disputed for the
advantage over him in Pastoral and Heroics; but I think all are
unanimous in giving him the precedence to Hesiod in his Georgics.
The truth of it is, the sweetness and rusticity of a Pastoral cannot be
so well expressed in any other tongue as in the Greek, when rightly
mixed and qualified with the Doric dialect; nor can the majesty of a
Heroic poem anywhere appear so well as in this language, which has
a natural greatness in it, and can he often rendered more deep and
sonorous by the pronunciation of the Ionians. But, in the middle
style, where the writers in both tongues are on a level, we see how
far Virgil has excelled all who have written in the same way with
him.
There has been abundance of criticism spent on Virgil's Pastorals
and Æneïs: but the Georgics are a subject which none of the
critics have sufficiently taken into their consideration; most of them
passing it over in silence, or casting it under the same head with
pastoral: a division by no means proper, unless we suppose the style
of a husbandman ought to be imitated in a Georgic, as that of a
shepherd is in a Pastoral. But, though the scene of both these
poems lies in the same place, the speakers in them are of a quite
different character, since the precepts of husbandry are not to be
delivered with the simplicity of a ploughman, but with the address of
a poet. No rules, therefore, that relate to pastoral, can any way
affect the Georgics, which fall under that class of poetry which
consists in giving plain and direct instructions to the reader; whether
they be moral duties, as those of Theognis and Pythagoras, or
philosophical speculations, as those of Aratus and Lucretius, or rules
of practice, as those of Hesiod and Virgil. Among these different
kinds of subjects, that which the Georgic goes upon, is, I think, the
meanest and least improving, but the most pleasing and delightful.
Precepts of morality, besides the natural corruption of our tempers,
which makes us averse to them, are so abstracted from ideas of
sense, that they seldom give an opportunity for those beautiful
descriptions and images which are the spirit and life of poetry.
Natural philosophy has indeed sensible objects to work upon; but
then it often puzzles the reader with the intricacy of its notion, and
perplexes him with the multitude of its disputes. But this kind of
poetry I am now speaking of, addresses itself wholly to the
imagination: it is altogether conversant among the fields and woods,
and has the most delightful part of nature for its province. It raises
in our minds a pleasing variety of scenes and landscapes, whilst it
teaches us, and makes the driest of its precepts look like a
description. A Georgic therefore is some part of the science of
husbandry put into a pleasing dress, and set off with all the beauties
and embellishments of poetry. Now, since this science of husbandry
is of a very large extent, the poet shows his skill in singling out such
precepts to proceed on, as are useful, and at the same time most
capable of ornament. Virgil was so well acquainted with this secret,
that, to set off his Georgic, he has run into a set of precepts, which
are almost foreign to his subject, in that beautiful account he gives
us of the signs in nature, which precede the changes of the weather.
And, if there be so much art in the choice of fit precepts, there is
much more required in the treating of them, that they may fall in
after each other by a natural unforced method, and show
themselves in the best and most advantageous light. They should all
be so finely wrought together in the same piece, that no coarse
seam may discover where they join; as, in a curious brede of needle-
work, one colour falls away by such just degrees, and another rises
so insensibly, that we see the variety, without being able to
distinguish the total vanishing of the one from the first appearance
of the other. Nor is it sufficient to range and dispose this body of
precepts into a clear and easy method, unless they are delivered to
us in the most pleasing and agreeable manner: for there are several
ways of conveying the same truth to the mind of man; and to chuse
the pleasantest of these ways, is that which chiefly distinguishes
poetry from prose, and makes Virgil's rules of husbandry pleasanter
to read than Varro's. Where the prose-writer tells us plainly what
ought to be done, the poet often conceals the precept in a
description, and represents his countryman performing the action in
which he would instruct his reader. Where the one sets out, as fully
and distinctly as he can, all the parts of the truth which he would
communicate to us, the other singles out the most pleasing
circumstance of this truth, and so conveys the whole in a more
diverting manner to the understanding. I shall give one instance, out
of a multitude of this nature, that might be found in the Georgics,
where the reader may see the different ways Virgil has taken to
express the same thing, and how much pleasanter every manner of
expression is, than the plain and direct mention of it would have
been. It is in the Second Georgic, where he tells us what trees will
bear grafting on each other:
Et sæpe alterius ramos impune videmus
Vertere in alterius, mutatamque insita mala
Ferre pyrum, et prunis lapidosa rubescere corna.
—Steriles platani malos gessere valentes:
Castaneæ fagus, ornusque incanuit albo
Flore pyri; glandemque sues fregere sub ulmis.
----Nec longum tempus; et ingens
Exiit ad cælum ramis felicibus arbos;
Miraturque novas frondes, et non sua poma.
Here, we see, the poet considered all the effects of this union
between trees of different kinds, and took notice of that effect which
had the most surprise, and by consequence the most delight in it, to
express the capacity that was in them of being thus united. This way
of writing is every where much in use among the poets, and is
particularly practised by Virgil, who loves to suggest a truth
indirectly, and, without giving us a full and open view of it, to let us
see just so much as will naturally lead the imagination into all the
parts that lie concealed. This is wonderfully diverting to the
understanding, thus to receive a precept, that enters, as it were,
through a by-way, and to apprehend an idea that draws a whole
train after it. For here the mind, which is always delighted with its
own discoveries, only takes the hint from the poet, and seems to
work out the rest by the strength of her own faculties.
But, since the inculcating precept upon precept will at length prove
tiresome to the reader, if he meets with no entertainment,—the poet
must take care not to encumber his poem with too much business,
but sometimes to relieve the subject with a moral reflection, or let it
rest a while for the sake of a pleasant and pertinent digression. Nor
is it sufficient to run out into beautiful and diverting digressions, (as
it is generally thought,) unless they are brought in aptly, and are
something of a piece with the main design of the Georgic: for they
ought to have a remote alliance at least to the subject, that so the
whole poem may be more uniform and agreeable in all its parts. We
should never quite lose sight of the country, though we are
sometimes entertained with a distant prospect of it. Of this nature
are Virgil's descriptions of the original of agriculture, of the
fruitfulness of Italy, of a country life, and the like, which are not
brought in by force, but naturally rise out of the principal argument
and design of the poem. I know no one digression in the Georgics
that may seem to contradict this observation, besides that in the
latter end of the first book, where the poet launches out into a
discourse of the battle of Pharsalia, and the actions of Augustus: but
it is worth while to consider how admirably he has turned the course
of his narration into its proper channel, and made his husbandman
concerned even in what relates to the battle, in those inimitable
lines:
Scilicet et tempus veniet, cum finibus illis
Agricola, incurvo terram molitus aratro,
Exesa inveniet scabrâ rubigine pila,
Aut gravibus rastris galeas pulsabit inanes,
Grandiaque effossis mirabitur ossa sepulcris.
And afterwards, speaking of Augustus's actions, he still remembers,
that agriculture ought to be some way hinted at throughout the
whole poem:
----Non ullus aratro
Dignus honos: squalent abductis arva colonis;
Et curvæ rigidum falces conflantur in ensem.
We now come to the style which is proper to a Georgic; and indeed
this is the part on which the poet must lay out all his strength, that
his words may be warm and glowing, and that every thing he
describes may immediately present itself, and rise up to the reader's
view. He ought, in particular, to be careful of not letting his subject
debase his style, and betray him into a meanness of expression, but
every where to keep up his verse in all the pomp of numbers, and
dignity of words.
I think nothing, which is a phrase or saying in common talk, should
be admitted into a serious poem; because it takes off from the
solemnity of the expression, and gives it too great a turn of
familiarity. Much less ought the low phrases and terms of art, that
are adapted to husbandry, have any place in such a work as the
Georgic, which is not to appear in the natural simplicity and
nakedness of its subject, but in the pleasantest dress that poetry can
bestow on it. Thus Virgil, to deviate from the common form of
words, would not make use of tempore, but sidere, in his first verse,
and every where else abounds with metaphors, Grecisms, and
circumlocutions, to give his verse the greater pomp, and preserve it
from sinking into a plebeian style. And herein consists Virgil's
master-piece, who has not only excelled all other poets, but even
himself, in the language of his Georgics, where we receive more
strong and lively ideas of things from his words, than we could have
done from the objects themselves; and find our imaginations more
affected by his descriptions, than they would have been by the very
sight of what he describes.
I shall now, after this short scheme of rules, consider the different
success that Hesiod and Virgil have met with in this kind of poetry,
which may give us some further notion of the excellence of the
Georgics. To begin with Hesiod:—If we may guess at his character
from his writings, he had much more of the husbandman than the
poet in his temper: he was wonderfully grave, discreet, and frugal:
he lived altogether in the country, and was probably, for his great
prudence, the oracle of the neighbourhood.—These principles of
good husbandry ran through his works, and directed him to the
choice of tillage and merchandize, for the subject of that which is
the most celebrated of them. He is every where bent on instruction,
avoids all manner of digressions, and does not stir out of the field
once in the whole Georgic. His method, in describing month after
month, with its proper seasons and employments, is too grave and
simple; it takes off from the surprise and variety of the poem, and
makes the whole look but like a modern almanack in verse. The
reader is carried through a course of weather, and may beforehand
guess whether he is to meet with snow or rain, clouds or sunshine,
in the next description. His descriptions, indeed, have abundance of
nature in them; but then it is nature in her simplicity and undress.
Thus, when he speaks of January,—The wild beasts, says he, run
shivering through the woods, with their heads stooping to the
ground, and their tails clapt between their legs; the goats and oxen
are almost flayed with cold: but it is not so bad with the sheep,
because they have a thick coat of wool about them. The old men too
are bitterly pinched with the weather: but the young girls feel
nothing of it, who sit at home with their mothers by a warm fire-
side. Thus does the old gentleman give himself up to a loose kind
of tattle rather than endeavour after a just poetical description. Nor
has he shown more of art or judgment in the precepts he has given
us, which are sown so very thick, that they clog the poem too much,
and are often so minute and full of circumstances, that they weaken
and unnerve his verse. But, after all, we are beholden to him for the
first rough sketch of a Georgic; where we may still discover
something venerable in the antiqueness of the work: but, if we
would see the design enlarged, the figures reformed, the colouring
laid on, and the whole piece finished, we must expect it from a
greater master's hand.
Virgil has drawn out the rules of tillage and planting into two books,
which Hesiod has dispatched in half a one; but has so raised the
natural rudeness and simplicity of his subject with such a
significancy of expression, such a pomp of verse, such variety of
transitions, and such a solemn air in his reflections, that, if we look
on both poets together, we see in one the plainness of a downright
countryman, and, in the other, something of a rustic majesty, like
that of a Roman dictator at the plough-tail. He delivers the meanest
of his precepts with a kind of grandeur: he breaks the clods, and
tosses the dung about, with an air of gracefulness. His
prognostications of the weather are taken out of Aratus, where we
may see how judiciously he has picked out those that are most
proper for his husbandman's observation; how he has enforced the
expression, and heightened the images, which he found in the
original.
The Second Book has more wit in it, and a greater boldness in its
metaphors, than any of the rest. The poet, with a great beauty,
applies oblivion, ignorance, wonder, desire, and the like, to his trees.
—The last Georgic has, indeed, as many metaphors, but not so
daring as this; for human thoughts and passions may be more
naturally ascribed to a bee, than to an inanimate plant. He who
reads over the pleasures of a country life, as they are described by
Virgil in the latter end of this book, can scarce be of Virgil's mind in
preferring even the life of a philosopher to it.
We may, I think, read the poet's clime in his description; for he
seems to have been in a sweat at the writing of it:
----O! qui me gelidis in vallibus Hæmi
Sistat, et ingenti ramorum protegat umbrâ!—
and is every where mentioning, among his chief pleasures, the
coolness of his shades and rivers, vales and grottoes, which a more
northern poet would have omitted for the description of a sunny hill,
and fire-side.
The Third Georgic seems to be the most laboured of them all: there
is a wonderful vigour and spirit in the description of the horse and
chariot-race. The force of love is represented in noble instances, and
very sublime expressions. The Scythian winter-piece appears so very
cold and bleak to the eye, that a man can scarce look on it without
shivering. The murrain, at the end, has all the expressiveness that
words can give. It was here that the poet strained hard to out-do
Lucretius in the description of his plague: and, if the reader would
see what success he had, he may find it at large in Scaliger.
But Virgil seems no where so well pleased, as when he is got among
his Bees in the Fourth Georgic; and ennobles the actions of so trivial
a creature, with metaphors drawn from the most important concerns
of mankind. His verses are not in a greater noise and hurry in the
battles of Æneas and Turnus, than in the engagement of two
swarms. And as, in his Æneïs, he compares the labours of his
Trojans to those of bees and pismires, here he compares the labours
of the bees to those of the Cyclops. In short, the last Georgic was a
good prelude to the Æneïs, and very well showed what the poet
could do in the description of what was really great, by his
describing the mock grandeur of an insect with so good a grace.
There is more pleasantness in the little platform of a garden, which
he gives us about the middle of this book, than in all the spacious
walks and water-works of Rapin. The speech of Proteus, at the end,
can never be enough admired, and was indeed very fit to conclude
so divine a work.
After this particular account of the beauties in the Georgics, I
should, in the next place, endeavour to point out its imperfections, if
it has any. But, though I think there are some few parts in it that are
not so beautiful as the rest, I shall not presume to name them, as
rather suspecting my own judgement, than I can believe a fault to
be in that poem, which lay so long under Virgil's correction, and had
his last hand put to it. The First Georgic was probably burlesqued in
the author's life-time; for we still find in the scholiasts a verse that
ridicules part of a line translated from Hesiod—Nudus ara, sere
nudus: And we may easily guess at the judgment of this
extraordinary critic, whoever he was, from his censuring this
particular precept. We may be sure Virgil would not have translated
it from Hesiod, had he not discovered some beauty in it; and indeed
the beauty of it is, what I have before observed to be frequently met
with in Virgil, the delivering the precept so indirectly, and singling
out the particular circumstance of sowing and ploughing naked, to
suggest to us, that these employments are proper only in the hot
season of the year.
I shall not here compare the style of the Georgics with that of
Lucretius, (which the reader may see already done in the preface to
the second volume of Miscellany Poems,) but shall conclude this
poem to be the most complete, elaborate, and finished piece of all
antiquity. The Æneïs, indeed, is of a nobler kind; but the Georgic is
more perfect in its kind. The Æneïs has a greater variety of beauties
in it; but those of the Georgic are more exquisite. In short, the
Georgic has all the perfection that can be expected in a poem
written by the greatest poet in the flower of his age, when his
invention was ready, his imagination warm, his judgment settled,
and all his faculties in their full vigour and maturity.
FOOTNOTES:
[3] Addison had already distinguished himself as a man of letters,
and as an admirer of Dryden, by a copy of verses addressed to
our author, and by a translation of the Fourth Book of the
Georgics, exclusive of the story of Aristæus. This last
performance is liberally commended by Dryden in the Postscript
to Virgil. The following Essay, which has been much admired for
judicious criticism contained in elegant language, was sent by him
to our author, but without permission to prefix the writer's name.
This circumstance led Tickell to throw some reflection on Dryden,
as if he had meant to assume to himself the merit of the
composition. This charge was refuted by Steele, in a letter to
Congreve, prefixed to an edition of the comedy of The
Drummer, in 1722, who proves, that the Essay was the same
paper which Dryden calls the Preface to the Georgics, and which
he acknowledges to have been sent by a friend, whose name he
was not at liberty to make public. See the article Addison in the
Biographia Britannica.
Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger
GEORGICS.
BOOK I.
ARGUMENT.
The poet, in the beginning of this book, propounds the general
design of each Georgic: and, after a solemn invocation of all the
gods, who are any way related to his subject, he addresses
himself, in particular, to Augustus, whom he compliments with
divinity; and, after, strikes into his business. He shows the
different kinds of tillage proper to different soils; traces out the
original of agriculture; gives a catalogue of the husbandman's
tools; specifies the employments peculiar to each season;
describes the changes of the weather, with the signs in heaven
and earth that forbode them; instances many of the prodigies
that happened near the time of Julius Cæsar's death; and shuts
up all with a supplication to the gods for the safety of Augustus,
and the preservation of Rome.[4]
What makes a plenteous harvest, when to
turn
The fruitful soil, and when to sow the corn;
The care of sheep, of oxen, and of kine,
And how to raise on elms the teeming vine;
The birth and genius of the frugal Bee,
I sing, Mæcenas, and I sing to thee.
Ye deities! who fields and plains protect,
Who rule the seasons, and the year direct,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com

More Related Content

PDF
An Introduction to Network Programming with Java 1st Edition Jan Graba
PDF
An Introduction to Network Programming with Java 1st Edition Jan Graba
PDF
Payara Revealed 1st Edition David R. Heffelfinger
PDF
Pro Drupal 7 For Windows Developers 1st Edition Brian Travis
PDF
Java persistence with my batis 3
PDF
Building Scalable Apps With Redis And Nodejs Joshua Johanan
PDF
The Java EE 6 Tutorial Basic Concepts 4th Edition Eric Jendrock
PDF
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Func...
An Introduction to Network Programming with Java 1st Edition Jan Graba
An Introduction to Network Programming with Java 1st Edition Jan Graba
Payara Revealed 1st Edition David R. Heffelfinger
Pro Drupal 7 For Windows Developers 1st Edition Brian Travis
Java persistence with my batis 3
Building Scalable Apps With Redis And Nodejs Joshua Johanan
The Java EE 6 Tutorial Basic Concepts 4th Edition Eric Jendrock
A Functional Approach to Java: Augmenting Object-Oriented Java Code with Func...

Similar to Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger (20)

PDF
Java Frameworks And Components Accelerate Your Web Application Development Mi...
PDF
High Performance Drupal Fast And Scalable Designs 1st Edition Sheltren
DOCX
Python Full Stack Development Course fsd
PDF
Mastering Laravel Christopher John Pecoraro
PPTX
Spring data jpa are used to develop spring applications
PDF
Building Soabased Composite Applications Using Netbeans Ide 6 Frank Jennings
PDF
Big Data Analytics With Java 1st Rajat Mehta
PDF
Spring Essentials 1st Edition Kunjumohamed Shameer Sattari Hamidreza
PPT
Was l iberty for java batch and jsr352
PDF
Modern TypeScript 1 / converted Edition Ben Beattie-Hood
PDF
Jakarta Struts Pocket Reference Chuck Cavaness Brian Keeton
PDF
Web Development With Java Using Hibernate Jsps And Servlets Tim Downey
PDF
Core Servlets and Javaserver Pages Advanced Technologies 2nd Edition Marty Hall
PDF
Java Coaching in Hyderabad introduction
PDF
Phpeclipse A User Guide 1st Edition Shu Wai Chow
PPT
Struts2-Spring=Hibernate
PDF
Modernizing Enterprise Java 1st Edition Markus Eisele
PDF
Opencms 7 Development Extending And Customizing Opencms Through Its Java Api ...
PDF
Developing Open Cloud Native Microservices Your Java Code In Actioncompliment...
PDF
UNV Are Dead - How to migrate to UNX in a few simple steps
Java Frameworks And Components Accelerate Your Web Application Development Mi...
High Performance Drupal Fast And Scalable Designs 1st Edition Sheltren
Python Full Stack Development Course fsd
Mastering Laravel Christopher John Pecoraro
Spring data jpa are used to develop spring applications
Building Soabased Composite Applications Using Netbeans Ide 6 Frank Jennings
Big Data Analytics With Java 1st Rajat Mehta
Spring Essentials 1st Edition Kunjumohamed Shameer Sattari Hamidreza
Was l iberty for java batch and jsr352
Modern TypeScript 1 / converted Edition Ben Beattie-Hood
Jakarta Struts Pocket Reference Chuck Cavaness Brian Keeton
Web Development With Java Using Hibernate Jsps And Servlets Tim Downey
Core Servlets and Javaserver Pages Advanced Technologies 2nd Edition Marty Hall
Java Coaching in Hyderabad introduction
Phpeclipse A User Guide 1st Edition Shu Wai Chow
Struts2-Spring=Hibernate
Modernizing Enterprise Java 1st Edition Markus Eisele
Opencms 7 Development Extending And Customizing Opencms Through Its Java Api ...
Developing Open Cloud Native Microservices Your Java Code In Actioncompliment...
UNV Are Dead - How to migrate to UNX in a few simple steps
Ad

Recently uploaded (20)

PDF
Classroom Observation Tools for Teachers
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
master seminar digital applications in india
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
Classroom Observation Tools for Teachers
O7-L3 Supply Chain Operations - ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
master seminar digital applications in india
VCE English Exam - Section C Student Revision Booklet
Abdominal Access Techniques with Prof. Dr. R K Mishra
2.FourierTransform-ShortQuestionswithAnswers.pdf
GDM (1) (1).pptx small presentation for students
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Cell Types and Its function , kingdom of life
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
human mycosis Human fungal infections are called human mycosis..pptx
PPH.pptx obstetrics and gynecology in nursing
Anesthesia in Laparoscopic Surgery in India
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Module 4: Burden of Disease Tutorial Slides S2 2025
Supply Chain Operations Speaking Notes -ICLT Program
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
O5-L3 Freight Transport Ops (International) V1.pdf
Ad

Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger

  • 1. Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger pdf download https://ebookfinal.com/download/jasperreports-reporting-for-java- developers-1st-edition-david-heffelfinger/ Explore and download more ebooks or textbooks at ebookfinal.com
  • 2. We have selected some products that you may be interested in Click the link to download now or visit ebookfinal.com for more options!. Java EE 7 Development with NetBeans 8 3rd Edition David R. Heffelfinger https://ebookfinal.com/download/java-ee-7-development-with- netbeans-8-3rd-edition-david-r-heffelfinger/ Java EE 5 Development using GlassFish Application Server 1st Ed. Edition David R. Heffelfinger https://ebookfinal.com/download/java-ee-5-development-using-glassfish- application-server-1st-ed-edition-david-r-heffelfinger/ Learn Objective C for Java Developers 1st Edition James Bucanek (Auth.) https://ebookfinal.com/download/learn-objective-c-for-java- developers-1st-edition-james-bucanek-auth/ Effective Unit Testing A guide for Java Developers 1st Edition Lasse Koskela https://ebookfinal.com/download/effective-unit-testing-a-guide-for- java-developers-1st-edition-lasse-koskela/
  • 3. Microservices for Java developers a hands on introduction to frameworks and containers First Edition. Edition Posta https://ebookfinal.com/download/microservices-for-java-developers-a- hands-on-introduction-to-frameworks-and-containers-first-edition- edition-posta/ OSWorkflow A guide for Java developers and architects to integrating open source Business Process Management 1st Ed. Edition Naya Lazo https://ebookfinal.com/download/osworkflow-a-guide-for-java- developers-and-architects-to-integrating-open-source-business-process- management-1st-ed-edition-naya-lazo/ Android Boot Camp for Developers Using Java A Guide to Creating Your First Android Apps Third Edition Corinne Hoisington https://ebookfinal.com/download/android-boot-camp-for-developers- using-java-a-guide-to-creating-your-first-android-apps-third-edition- corinne-hoisington/ The Definitive Guide to JasperReports 1st Edition Teodor Danciu https://ebookfinal.com/download/the-definitive-guide-to- jasperreports-1st-edition-teodor-danciu/ HTML5 for NET Developers Jim Jackson https://ebookfinal.com/download/html5-for-net-developers-jim-jackson/
  • 5. Jasperreports Reporting for Java Developers 1st Edition David Heffelfinger Digital Instant Download Author(s): David Heffelfinger ISBN(s): 9781904811909, 1904811906 Edition: 1 File Details: PDF, 9.08 MB Year: 2006 Language: english
  • 6. JasperReports for Java Developers David R. Heffelfi nger $ 44.99 US £ 27.99 UK € 41.99 EU Prices do not include local sales tax or VAT where applicable Packt Publishing Birmingham - Mumbai www.packtpub.com JasperReports for Java Developers JasperReports is the world’s most popular embeddable open-source Java reporting library, providing Java developers with the power to easily create rich print and web reports. This book shows you exactly how to get started, and develop the skills to get the most from JasperReports. The book steers you through each point of report setup, from creating, designing, formatting, and exporting reports with data from a wide range of datasources, to integrating JasperReports with other Java frameworks. What you will learn from this book • What JasperReports is, and what it can do for you • Adding reporting capabilities to your application • Creating and formatting reports • Report layout and design • Working with database datasources and XML • Working with Java object datasources • Adding charts and graphics to a report • Working with crosstabs, subdatasets, and scriptlets • Working with the iReport report designer • Exporting reports to PDF, Excel spreadsheet or Word document format • Integrating JasperReports with other Java frameworks like Spring, JavaServer Faces, Struts, and Hibernate Who this book is written for This book is for Java developers who want to create rich reports for either the Web or print, and want to get started quickly with JasperReports to do this. No knowledge of Jasper Reports is presumed, although familiarity with Java, SQL, and XML is assumed. F r o m T e c h n o l o g i e s t o S o l u t i o n s JasperReports for Java Developers Create, Design, Format, and Export Reports with the World’s Most Popular Java Reporting Library David R. Heffelfinger
  • 7. JasperReports for Java Developers Create, Design, Format, and Export Reports with the World's Most Popular Java Reporting Library David R. Heffelfinger BIRMINGHAM - MUMBAI
  • 8. JasperReports for Java Developers Create, Design, Format, and Export Reports with the World's Most Popular Java Reporting Library Copyright © 2006 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: July 2006 Production Reference: 1180706 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 1-904811-90-6 www.packtpub.com Cover Image by www.visionwt.com
  • 9. Credits Author David R. Heffelfinger Reviewers Thomas M. Ose Meenakshi Singh Sarosh Khateeb Development Editor Douglas Paterson Assistant Development Editor Nikhil Bangera Technical Editor Priyanka Baruah Project Manager Patricia Weir Editorial Manager Dipali Chittar Indexer Mithil Kulkarni Proofreader Chris Smith Production Coordinator Manjiri Nadkarni Layouts and Illustrations Shantanu Zagade Cover Designer Manjiri Nadkarni
  • 10. About the Author David R. Heffelfinger has been developing software professionally since 1995; he has been using Java as his primary programming language since 1996. He has worked on many large-scale projects for several clients including Freddie Mac, Fannie Mae, and the US Department of Defense. He has a Masters degree in Software Engineering from Southern Methodist University. David is editor in chief of Ensode.net (http://www.ensode.net ), a website about Java, Linux, and other technology topics. I would like to thank everyone at Packt Publishing, particularly Douglas Paterson, Patricia Weir, Nikhil Bangera, and Priyanka Baruah, and the technical reviewer, Thomas Ose. This book wouldn't have been a reality without your help. I would especially like to thank my family for their support. A special dedication goes to my wife and daughter.
  • 11. Table of Contents Preface 1 Chapter 1: An Overview of JasperReports 7 Brief History of JasperReports 7 What is JasperReports? 8 The JasperReports Open-Source License 9 Features of JasperReports 9 Flexible Report Layout 9 Multiple Ways to Present Data 10 Multiple Ways to Supply Data 10 Multiple Datasources 10 Watermarks 10 Subreports 11 Exporting Capabilities 11 Class Library Dependencies 13 Typical Workflow 13 Where to Get Help? 16 Summary 17 Chapter 2: Adding Reporting Capabilities to Java Applications 19 Downloading JasperReports 19 Setting Up Our Environment 22 JasperReports Class Library 23 Required Libraries for Report Compilation 23 Jakarta Commons 24 Optional Libraries and Tools 25 Apache ANT 25 JDT Compiler 26 JDBC Driver 26
  • 12. Table of Contents [ ii ] iText 27 JFreeChart 27 Jakarta POI 27 Summary 28 Chapter 3: Creating Your First Report 29 Creating a JRXML Report Template 29 Previewing the XML Report Template 30 Creating a Binary Report Template 33 Compiling a JRXML Template Programmatically 33 Compiling a JRXML Template through ANT 36 Generating the Report 38 Viewing the Report 40 Displaying Reports on a Web Browser 43 Elements of a JRXML Report Template 45 <property> 46 <import> 46 <reportFont> 46 <parameter> 47 <queryString> 47 <field> 47 <variable> 47 <group> 48 <background> 48 <title> 48 <pageHeader> 49 <columnHeader> 49 <detail> 50 <columnFooter> 50 <pageFooter> 51 <lastPageFooter> 51 <summary> 52 Summary 54 Chapter 4: Creating Dynamic Database Reports 55 Database for Our Reports 55 Generating Database Reports 57 Embedding SQL Queries into a Report Template 57 Generating the Report 60 Modifying a Report Query via Report Parameters 65 Database Reporting via a Datasource 70 Database Report Methods Compared 76
  • 13. Table of Contents [ iii ] Summary 77 Chapter 5: Working with Other Datasources 79 Empty Datasources 80 Map Datasources 87 Java Objects as Datasources 92 TableModels as Datasources 99 XML as Datasource 105 Custom Datasources 109 Writing a Custom JRDataSource Implementation 110 Using the Custom JRDataSource Implementation 113 Summary 114 Chapter 6: Report Layout and Design 115 Controlling Report-Wide Layout Properties 116 Setting Text Properties 117 Styles 117 Setting Text Style for Individual Report Elements 120 Setting Styles for Text Segments 121 Setting a Report's Background 122 Adding Multiple Columns to a Report 125 A Few Things about Report Columns 128 Grouping Report Data 129 Report Expressions 133 Report Variables 137 Built-In Report Variables 146 Stretching Text Fields to Accommodate Data 146 Laying Out Report Elements 149 Setting the Size and Position of a Report Element 152 Using the <frame> Element 157 Hiding Repeated Values 158 Subreports 162 Summary 168 Chapter 7: Adding Charts and Graphics to Reports 169 Adding Geometrical Shapes to a Report 169 Adding Lines to a Report 169 Adding Rectangles to a Report 171 Adding Ellipses to a Report 172
  • 14. Table of Contents [ iv ] Adding Images to a Report 173 Attributes of the <image> Element 175 evaluationTime 175 evaluationGroup 175 hAlign 175 vAlign 176 isLazy 176 isUsingCache 176 onErrorType 176 Adding Charts to a Report 177 Attributes of the <chart> Element 177 customizerClass 177 evaluationGroup 177 evaluationTime 177 isShowLegend 178 Chart Customization 178 Chart Datasets 179 Attributes of the <dataset> Element 179 Plotting Charts 180 Attributes of the <plot> Element 180 Pie Charts 181 Bar Charts 184 XY Line Charts 187 Other Types of Charts 190 Summary 190 Chapter 8: Other JasperReports Features 191 Report Localization 191 Scriptlets 194 Crosstabs 200 <columnGroup> 204 <crosstabCell> 204 <crosstabDataset> 204 <crosstabParameter> 204 <measure> 204 <parametersMapExpression> 205 <reportElement> 205 <rowGroup> 205 <whenNoDataCell> 205 Subdatasets 205 Adding Hyperlinks and Anchors to Reports 212 Bookmarks 215 Handling Very Large Reports 218
  • 15. Table of Contents [ ] Summary 220 Chapter 9: Exporting to Other Formats 221 Exporting Overview 221 Exporting to PDF 223 Exporting to RTF 225 Exporting to Excel 227 Exporting to HTML 229 Exporting to XML 231 Exporting to CSV 234 Exporting to Plain Text 237 Directing HTML Reports to a Browser 240 Summary 246 Chapter 10: Graphical Report Design with iReport 247 Obtaining iReport 248 Setting Up iReport 249 Creating a Database Report in Record Time 254 Creating a Report From Scratch 263 Creating More Elaborate Reports 273 Adding Images to a Report 274 Adding Multiple Columns to a Report 275 Grouping Report Data 278 Adding Charts to a Report 282 Help and Support 288 Summary 288 Chapter 11: Integrating JasperReports with other Frameworks 289 Integrating JasperReports with Hibernate 289 Integrating JasperReports with Spring 303 Integrating JasperReports with JavaServer Faces 309 Integrating JasperReports with Struts 314 Summary 320 Index 321
  • 17. Preface JasperReports was started by Teodor Danciu, in 2001, when he was faced with the task of evaluating reporting tools for a project he was working on. The existing solutions that he found were too expensive for his project's budget. Therefore, he decided to write his own reporting tool, JasperReports, which has now become immensely popular, and is currently one of the most popular (if not the most popular) Java reporting tool available. JasperReports is an open-source Java class library designed to aid developers with the task of adding reporting capabilities to Java applications by providing an API to facilitate the ability to generate reports from any kind of Java application. Though primarily used to add reporting capabilities to web-based applications, it can also be used to create standalone desktop or command-line Java applications for report generation. This book steers you through each point of report setup, to creating, designing, formatting, and exporting reports with data from a wide range of datasources, and integrating JasperReports with other Java frameworks. What This Book Covers Chapter 1 covers JasperReports' history, and its features and gives us an overview of the steps involved in generating reports using JasperReports. Chapter 2 shows us how to embed JasperReports into client and server-side Java applications. We will install JasperReports and learn how to identify and install required libraries. We will also see how to set up our development and execution environment to add reporting capabilities to Java applications. In Chapter 3, we create our first static JasperReports both programmatically and by using the ANT tool. We will see how to work with JRXML and binary report templates to generate reports in JasperReports' native format. We will then learn how to view these reports.
  • 18. Preface [ ] In Chapter 4, we learn how to create dynamic reports. We will do this by embedding SQL queries in the JRXML report template, or by passing the database data to the compiled report via a datasource. In Chapter 5, we cover how to use datasources other than databases to create reports. Specifically, we will learn to create reports from empty datasources, Java objects, TableModels, XML data, and also from our custom-created datasources. In Chapter 6, we cover how to create elaborate layouts for our reports by adding background images or text to a report, logically grouping report data, conditionally printing report data, and creating subreports. In Chapter 7, we cover how to take advantage of JasperReports' graphical features and create reports with graphical data like geometric shapes, images, and 2-D and 3-D charts. Chapter 8 discusses advanced JasperReports' features like creating crosstab (cross- tabulation) reports and adding anchors, hyperlinks, and bookmarks. We then see how to work with subdatasets and how to execute snippets of Java code by using scriptlets. This chapter also shows how to display report text in different languages. In Chapter 9, we cover how to export our reports to all formats supported by JasperReports; these include PDF, RTF, Excel, HTML, CSV, XML, and plain text. We also see how to direct exported reports to a browser. Chapter 10 covers iReport, which is a report designer that can help us visually generate JRXML templates. This chapter shows how to install and get started with iReport. iReport can be used to do everything that we have covered so far in this book and this chapter shows us how. Chapter 11 covers the integration of JasperReports with three of the most popular Java web application frameworks around—Spring Web MVC, JavaServer Faces, and Struts. We shall also see how to generate reports with data obtained using Hibernate, which is a popular Java Object Relational Mapping tool. What You Need for This Book To use this book, you will of course need JasperReports. This is freely downloadable from http://www.sourceforge.net/projects/jasperreports. JasperReports has its own requirements for proper and successful functioning: Java Development Kit (JDK) 1.4 or newer (http://java.sun.com/javase/downloads/ index.jsp), ANT 1.6 or newer (http://ant.apache.org/), iReport 1.2 or newer (http://ireport.sourceforge.net/). Any operating system supporting Java can be used (any modern version of Microsoft Windows, Mac OS X, Linux, or Solaris).
  • 19. Preface [ ] Conventions In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning. There are three styles for code. Code words in text are shown as follows: All JRXML files contain a jasperReport root element that can contain many sub-elements. A block of code will be set as follows: package net.ensode.jasperbook; import java.util.HashMap; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperFillManager; When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold: detail band height=20 staticText reportElement x=20 y=0 width=200 height=20/ text![CDATA[If you don't see this, it didn't work]]/text /staticText /band /detail Any command-line input and output is written as follows: $ ant New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: clicking the Next button moves you to the next screen. Warnings or important notes appear in a box like this. Tips and tricks appear like this.
  • 20. Preface [ ] Reader Feedback Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of. To send us general feedback, simply drop an email to feedback@packtpub.com, making sure to mention the book title in the subject of your message. If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email suggest@ packtpub.com. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors. Customer Support Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase. Downloading the Example Code for the Book Visit http://www.packtpub.com/support, and select this book from the list of titles to download any example code or extra resources for this book. The files available for download will then be displayed. The downloadable files contain instructions on how to use them. Errata Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/ support, selecting your book, clicking on the Submit Errata link, and entering the details of your errata. Once your errata have been verified, your submission will be accepted and the errata added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
  • 21. Preface [ ] Questions You can contact us at questions@packtpub.com if you are having a problem with some aspect of the book, and we will do our best to address it.
  • 23. An Overview of JasperReports This chapter presents an overview of JasperReports and explains its capabilities and features. Here is a brief outline of the topics covered in this chapter: A brief history of JasperReports What JasperReports is, and what it can do for us A brief discussion of the JasperReports open-source license The features of JasperReports JasperReports' class library dependencies A brief overview of the steps required to generate reports with JasperReports Where to get support for JasperReports Brief History of JasperReports JasperReports was started by Teodor Danciu, in 2001, when he was faced with the task of evaluating reporting tools for a project he was working on. The existing solutions that he found were too expensive for his project's budget. Therefore, he decided to write his own reporting tool. The project for which he was evaluating reporting tools got canceled; but, nevertheless, he started working on JasperReports in his spare time. He registered the project on http://sourceforge.net in September, 2001. Shortly after, he started getting emails from interested potential users even though he had not yet released any code. JasperReports version 0.1.5 was released in November, 2001. Since then, JasperReports has become immensely popular, and is currently one of the most popular (if not the most popular) Java reporting tools available. As a testament to JasperReports' enormous popularity, a Google search for java reporting tool returns the JasperReports website as its first result. • • • • • • •
  • 24. An Overview of JasperReports [ ] Until recently, JasperReports was basically a one-man project, with Teodor working on it in his spare time. In April 2005, a company called JasperSoft was formally launched at the MySQL User Conference in California. JasperSoft sponsors JasperReports' development, allowing Teodor and other JasperSoft developers to work full-time on JasperReports. JasperSoft also provides commercial support and services for JasperReports and related products, including the iReport Visual Designer for JasperReports. In addition to providing support for JasperReports and iReport, JasperSoft sells commercial applications incorporating JasperReports. JasperSoft has raised over 8 million dollars in venture capital funding, no small feat in these post-dotcom days. This investment is a clear indication that venture capitalists have confidence in the success of JasperSoft, and, by extension, in the success of JasperReports. According to JasperSoft, JasperReports has been downloaded over 300,000 times, and gets over 20,000 downloads a month. It has been deployed in over 10,000 companies and Independent Software Vendors (ISVs). What is JasperReports? JasperReports is an open-source Java class library designed to aid developers with the task of adding reporting capabilities to Java applications. Since it is not a standalone tool, it cannot be installed on its own. Instead, it is embedded into Java applications by including its library in the application's CLASSPATH. JasperReports is a Java class library, and is not meant for end users, but rather is targeted towards Java developers who need to add reporting capabilities to their applications. Although JasperReports is primarily used to add reporting capabilities to web-based applications via the Servlet API, it has absolutely no dependencies on the Servlet API or any other Java EE library. It is, therefore, by no means limited to web applications. There is nothing stopping us from creating standalone desktop or command-line Java applications to generate reports with JasperReports. After all, JasperReports is nothing but a Java class library providing an API to facilitate the ability to generate reports from any kind of Java application. JasperReports requires a Java Development Kit (JDK) 1.3 or newer in order to successfully compile applications incorporating the JasperReports Java class library, and a Java Runtime Environment 1.3 or newer to successfully execute these applications. Older versions of JasperReports required a JDK to successfully execute JasperReports applications (strictly speaking, JasperReports required tools.jar to be in the CLASSPATH, and tools.jar is included in the JDK, not the JRE). However, from version 0.6.4, JasperReports is bundled with the Eclipse Java Development Tools (JDT) compiler, and no longer needs a JDK to execute deployed applications. Examples in this book are developed using JDK 1.5, but should compile and execute successfully with any JDK or JRE supported by JasperReports.
  • 25. Chapter 1 [ ] The JasperReports Open-Source License JasperReports is licensed under the Lesser GNU Public License (LGPL). This license was chosen for JasperReports since, unlike the GPL, it allows JasperReports to be used in both open-source and closed-source applications. Applications linking to the JasperReports Java class library do not need to be open-source. However, if you consider making modifications to the existing JasperReports source code, then your modifications will have to be released under the LGPL. See http://jasperreports. sourceforge.net/license.html for the complete license. Features of JasperReports In addition to textual data, JasperReports is capable of generating professional reports including images, charts, and graphs. Some of the major JasperReports features include: It has flexible report layout. It is capable of presenting data textually or graphically. It allows developers to supply data in multiple ways. It can accept data from multiple datasources. It can generate watermarks. It can generate subreports. It is capable of exporting reports to a variety of formats. Each of these features is briefly described in the next few sections. Flexible Report Layout JasperReports allows us to separate data into optional report sections. These sections include: The report title, which will appear once at the top of the report. A page header, which will appear at the top of every page. A detail section, which typically contains the primary report data. A page footer, which will appear at the bottom of every page. A summary section, which will appear at the end of the report. All of these and other report sections are discussed in detail in Chapter 6. In addition to allowing us to define report sections, JasperReports allows the creation of elaborate dynamic layouts based on the contents of the report. For example, depending on the value of a report field, data can be hidden or displayed in a report, • • • • • • • • • • • •
  • 26. Discovering Diverse Content Through Random Scribd Documents
  • 30. The Project Gutenberg eBook of The Works of John Dryden, now first collected in eighteen volumes. Volume 14
  • 31. This ebook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this ebook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook. Title: The Works of John Dryden, now first collected in eighteen volumes. Volume 14 Author: John Dryden Release date: January 19, 2021 [eBook #64337] Most recently updated: October 18, 2024 Language: English Credits: Jonathan Ingram, Matthias Grammel and the Online Distributed Proofreading Team at https://www.pgdp.net *** START OF THE PROJECT GUTENBERG EBOOK THE WORKS OF JOHN DRYDEN, NOW FIRST COLLECTED IN EIGHTEEN VOLUMES. VOLUME 14 ***
  • 33. THE WORKS OF JOHN DRYDEN, NOW FIRST COLLECTED IN EIGHTEEN VOLUMES. ILLUSTRATED WITH NOTES, HISTORICAL, CRITICAL, AND EXPLANATORY, AND A LIFE OF THE AUTHOR, BY WALTER SCOTT, Esq. VOL. XIV. LONDON: PRINTED FOR WILLIAM MILLER, ALBEMARLE STREET
  • 34. BY JAMES BALLANTYNE AND CO. EDINBURGH. 1808.
  • 35. CONTENTS OF VOLUME FOURTEENTH. PAGE. The Georgics, translated from Virgil 1 Dedication to the Earl of Chesterfield 3 An Essay on the Georgics, by Mr Addison 14 Book I. 27 Book II. 49 Book III. 73 Book IV. 98 Notes on Book IV. 123 Æneis 125 Dedication to the Marquis of Normanby, Earl of Mulgrave, c. 127 Book I. 231 Notes on Book I. 262 Book II. 264 Book III. 296 Notes on Book III. 323 Book IV. 324 Note on Book IV. 353 Æneis, Book V. 355 Book VI. 388
  • 36. Notes on Book VI. 424 Book VII. 429 Notes on Book VII. 461
  • 39. TO THE RIGHT HONOURABLE PHILIP, EARL OF CHESTERFIELD, c.[1] MY LORD, I cannot begin my address to your lordship better than in the words of Virgil: ----Quod optanti divûm promittere nemo Auderet, volvenda dies, en, attulit ultro. Seven years together I have concealed the longing which I had to appear before you: a time as tedious as Æneas passed in his wandering voyage, before he reached the promised Italy. But I considered, that nothing which my meanness could produce, was worthy of your patronage. At last this happy occasion offered, of presenting to you the best poem of the best poet. If I balked this opportunity, I was in despair of finding such another; and, if I took it, I was still uncertain whether you would vouchsafe to accept it from my hands. It was a bold venture which I made, in desiring your permission to lay my unworthy labours at your feet. But my rashness has succeeded beyond my hopes; and you have been pleased not to suffer an old man to go discontented out of the world, for want of that protection, of which he had been so long ambitious. I have known a gentleman in disgrace, and not daring to appear before
  • 40. King Charles the Second, though he much desired it: at length he took the confidence to attend a fair lady to the court, and told his majesty, that, under her protection, he had presumed to wait on him. With the same humble confidence, I present myself before your lordship, and, attending on Virgil, hope a gracious reception. The gentleman succeeded, because the powerful lady was his friend; but I have too much injured my great author, to expect he should intercede for me. I would have translated him; but, according to the literal French and Italian phrases, I fear I have traduced him. It is the fault of many a well-meaning man, to be officious in a wrong place, and do a prejudice where he had endeavoured to do a service. Virgil wrote his Georgics in the full strength and vigour of his age, when his judgment was at the height, and before his fancy was declining. He had (according to our homely saying) his full swing at this poem, beginning it about the age of thirty-five, and scarce concluding it before he arrived at forty. It is observed, both of him and Horace, (and I believe it will hold in all great poets,) that, though they wrote before with a certain heat of genius which inspired them, yet that heat was not perfectly digested. There is required a continuance of warmth, to ripen the best and noblest fruits. Thus Horace, in his First and Second Book of Odes, was still rising, but came not to his meridian till the Third; after which, his judgment was an overpoise to his imagination: he grew too cautious to be bold enough; for he descended in his Fourth by slow degrees, and, in his Satires and Epistles, was more a philosopher and a critic than a poet. In the beginning of summer, the days are almost at a stand, with little variation of length or shortness, because at that time the diurnal motion of the sun partakes more of a right line than of a spiral. The same is the method of nature in the frame of man. He seems at forty to be fully in his summer tropic; somewhat before, and somewhat after, he finds in his soul but small increases or decays. From fifty to three score, the balance generally holds even, in our colder climates: for he loses not much in fancy; and judgement, which is the effect of observation, still increases. His succeeding years afford him little more than the stubble of his own harvest: yet, if his constitution be healthful, his mind may still retain
  • 41. a decent vigour; and the gleanings of that Ephraim, in comparison with others, will surpass the vintage of Abiezer. I have called this somewhere, by a bold metaphor, a green old age; but Virgil has given me his authority for the figure— Jam senior; sed cruda Deo, viridisque senectus. Among those few who enjoy the advantage of a latter spring, your lordship is a rare example; who, being now arrived at your great climacteric, yet give no proof of the least decay of your excellent judgment and comprehension of all things which are within the compass of human understanding. Your conversation is as easy as it is instructive; and I could never observe the least vanity, or the least assuming, in any thing you said, but a natural unaffected modesty, full of good sense, and well digested; a clearness of notion, expressed in ready and unstudied words. No man has complained, or even can, that you have discoursed too long on any subject; for you leave us in an eagerness of learning more; pleased with what we hear, but not satisfied, because you will not speak so much as we could wish. I dare not excuse your lordship from this fault; for, though it is none in you, it is one to all who have the happiness of being known to you. I must confess, the critics make it one of Virgil's beauties, that, having said what he thought convenient, he always left somewhat for the imagination of his readers to supply; that they might gratify their fancies, by finding more in what he had written, than at first they could; and think they had added to his thought, when it was all there before-hand, and he only saved himself the expence of words. However it was, I never went from your lordship, but with a longing to return, or without a hearty curse to him who invented ceremonies in the world, and put me on the necessity of withdrawing, when it was my interest, as well as my desire, to have given you a much longer trouble. I cannot imagine, (if your lordship will give me leave to speak my thoughts,) but you have had a more than ordinary vigour in your youth; for too much of heat is required at first, that there may not too little be left at last. A prodigal fire is
  • 42. only capable of large remains; and yours, my lord, still burns the clearer in declining. The blaze is not so fierce as at the first; but the smoke is wholly vanished; and your friends, who stand about you, are not only sensible of a cheerful warmth, but are kept at an awful distance by its force. In my small observations of mankind, I have ever found, that such as are not rather too full of spirit when they are young, degenerate to dulness in their age. Sobriety in our riper years is the effect of a well-concocted warmth: but, where the principles are only phlegm, what can be expected from the waterish matter, but an insipid manhood, and a stupid old infancy—discretion in leading-strings, and a confirmed ignorance on crutches? Virgil, in his Third Georgic, when he describes a colt, who promises a courser for the race, or for the field of battle, shews him the first to pass the bridge, which trembles under him, and to stem the torrent of the flood. His beginnings must be in rashness—a noble fault: but time and experience will correct that error, and tame it into a deliberate and well-weighed courage, which knows both to be cautious and to dare, as occasion offers. Your lordship is a man of honour, not only so unstained, but so unquestioned, that you are the living standard of that heroic virtue; so truly such, that if I would flatter you, I could not. It takes not from you, that you were born with principles of generosity and probity; but it adds to you, that you have cultivated nature, and made those principles the rule and measure of all your actions. The world knows this, without my telling; yet poets have a right of recording it to all posterity: Dignum laude virum Musa vetat mori. Epaminondas, Lucullus, and the two first Cæsars, were not esteemed the worse commanders, for having made philosophy and the liberal arts their study. Cicero might have been their equal, but that he wanted courage. To have both these virtues, and to have improved them both with a softness of manners and a sweetness of conversation—few of our nobility can fill that character. One there is, and so conspicuous by his own light, that he needs not
  • 43. Digito monstrari, et dicier, Hic est! To be nobly born, and of an ancient family, is in the extremes of fortune, either good or bad; for virtue and descent are no inheritance. A long series of ancestors shews the native with great advantage at the first; but, if he any way degenerate from his line, the least spot is visible on ermine. But, to preserve this whiteness in its original purity, you, my lord, have, like that ermine, forsaken the common tract of business, which is not always clean: you have chosen for yourself a private greatness, and will not be polluted with ambition. It has been observed in former times, that none have been so greedy of employments, and of managing the public, as they who have least deserved their stations. But such only merit to be called patriots, under whom we see their country flourish. I have laughed sometimes, (for who would always be a Heraclitus?) when I have reflected on those men, who from time to time have shot themselves into the world. I have seen many successions of them; some bolting out upon the stage with vast applause, and others hissed off, and quitting it with disgrace. But, while they were in action, I have constantly observed, that they seemed desirous to retreat from business; greatness, they said, was nauseous, and a crowd was troublesome: a quiet privacy was their ambition. Some few of them, I believe, said this in earnest, and were making a provision against future want, that they might enjoy their age with ease. They saw the happiness of a private life, and promised to themselves a blessing, which every day it was in their power to possess. But they deferred it, and lingered still at court, because they thought they had not yet enough to make them happy: they would have more, and laid in, to make their solitude luxurious:—a wretched philosophy, which Epicurus never taught them in his garden. They loved the prospect of this quiet in reversion, but were not willing to have it in possession: they would first be old, and make as sure of health and life, as if both of them were at their dispose. But put them to the necessity of a present choice, and they preferred continuance in power; like the wretch who called Death to his assistance, but refused him when he came. The great Scipio was
  • 44. not of their opinion, who indeed sought honours in his youth, and endured the fatigues with which he purchased them. He served his country when it was in need of his courage and conduct, till he thought it was time to serve himself; but dismounted from the saddle when he found the beast which bore him began to grow restiff and ungovernable. But your lordship has given us a better example of moderation. You saw betimes, that ingratitude is not confined to commonwealths; and therefore, though you were formed alike for the greatest of civil employments and military commands, yet you pushed not your fortune to rise in either, but contented yourself with being capable, as much as any whosoever of defending your country with your sword, or assisting it with your counsel, when you were called.[2] For the rest, the respect and love which was paid you, not only in the province where you live, but generally by all who had the happiness to know you, was a wise exchange for the honours of the court—a place of forgetfulness, at the best, for well-deservers. It is necessary, for the polishing of manners, to have breathed that air; but it is infectious, even to the best morals, to live always in it. It is a dangerous commerce, where an honest man is sure at the first of being cheated, and he recovers not his loses, but by learning to cheat others. The undermining smile becomes at length habitual; and the drift of his plausible conversation is only to flatter one, that he may betray another. Yet it is good to have been a looker on, without venturing to play; that a man may know false dice another time, though he never means to use them. I commend not him who never knew a court, but him who forsakes it because he knows it. A young man deserves no praise, who, out of melancholy zeal, leaves the world before he has well tried it, and runs headlong into religion. He who carries a maidenhead into a cloister, is sometimes apt to lose it there, and to repent of his repentance. He only is like to endure austerities, who has already found the inconvenience of pleasures: for almost every man will be making experiments in one part or another of his life; and the danger is the less when we are young; for, having tried it early, we shall not be apt to repeat it afterwards. Your lordship
  • 45. therefore may properly be said to have chosen a retreat, and not to have chosen it till you had maturely weighed the advantages of rising higher, with the hazards of the fall. Res, non parta labore, sed relicta, was thought by a poet to be one of the requisites to a happy life. Why should a reasonable man put it into the power of Fortune to make him miserable, when his ancestors have taken care to release him from her? Let him venture, says Horace, qui zonam perdidit. He, who has nothing, plays securely; for he may win, and cannot be poorer if he loses: but he who is born to a plentiful estate, and is ambitious of offices at court, sets a stake to Fortune, which she can seldom answer. If he gains nothing, he loses all, or part of what was once his own; and, if he gets, he cannot be certain but he may refund. In short, however he succeeds, it is covetousness that induced him first to play; and covetousness is the undoubted sign of ill sense at bottom. The odds are against him, that he loses; and one loss may be of more consequence to him than all his former winnings. It is like the present war of the Christians against the Turk: every year they gain a victory, and by that a town; but, if they are once defeated, they lose a province at a blow, and endanger the safety of the whole empire. You, my lord, enjoy your quiet in a garden, where you have not only the leisure of thinking, but the pleasure to think of nothing which can discompose your mind. A good conscience is a port which is land-locked on every side, and where no winds can possibly invade, no tempests can arise. There a man may stand upon the shore, and not only see his own image, but that of his Maker, clearly reflected from the undisturbed and silent waters. Reason was intended for a blessing; and such it is to men of honour and integrity, who desire no more than what they are able to give themselves; like the happy old Corycian, whom my author describes in his Fourth Georgic, whose fruits and sallads, on which he lived contented, were all of his own growth, and his own plantation. Virgil seems to think, that the blessings of a country-life
  • 46. are not complete without an improvement of knowledge by contemplation and reading: O fortunatos nimium, sua si bona nôrint, Agricolas! It is but half possession, not to understand that happiness which we possess. A foundation of good sense, and a cultivation of learning, are required to give a seasoning to retirement, and make us taste the blessing. God has bestowed on your lordship the first of these; and you have bestowed on yourself the second. Eden was not made for beasts, though they were suffered to live in it, but for their master, who studied God in the works of his creation. Neither could the devil have been happy there with all his knowledge; for he wanted innocence to make him so. He brought envy, malice, and ambition, into Paradise, which soured to him the sweetness of the place. Wherever inordinate affections are, 'tis hell. Such only can enjoy the country, who are capable of thinking when they are there, and have left their passions behind them in the town. Then they are prepared for solitude; and, in that solitude, is prepared for them, Et secura quies, et nescia fallere vita. As I began this Dedication with a verse of Virgil, so I conclude it with another. The continuance of your health, to enjoy that happiness which you so well deserve, and which you have provided for yourself, is the sincere and earnest wish of Your lordship's Most devoted And most obedient servant, John Dryden.
  • 47. FOOTNOTES: [1] Philip Stanhope, second Earl of Chesterfield, born in 1634. He was a man of considerable talent and political activity; was active in forwarding the Restoration; and enjoyed at the court of Charles II. several offices, but was now retired. He died in 1713. [2] Dryden's praise, though often hyperbolical, is always founded on some circumstances appropriate to its object. Lord Chesterfield, who had enjoyed offices of honour at the court of Charles II., now lived in retirement at an elegant villa, according to Mr Malone, near Twickenham.
  • 48. AN ESSAY ON THE GEORGICS. BY MR ADDISON.[3] Virgil may be reckoned the first who introduced three new kinds of poetry among the Romans, which he copied after three the greatest masters of Greece. Theocritus and Homer have still disputed for the advantage over him in Pastoral and Heroics; but I think all are unanimous in giving him the precedence to Hesiod in his Georgics. The truth of it is, the sweetness and rusticity of a Pastoral cannot be so well expressed in any other tongue as in the Greek, when rightly mixed and qualified with the Doric dialect; nor can the majesty of a Heroic poem anywhere appear so well as in this language, which has a natural greatness in it, and can he often rendered more deep and sonorous by the pronunciation of the Ionians. But, in the middle style, where the writers in both tongues are on a level, we see how far Virgil has excelled all who have written in the same way with him. There has been abundance of criticism spent on Virgil's Pastorals and Æneïs: but the Georgics are a subject which none of the critics have sufficiently taken into their consideration; most of them
  • 49. passing it over in silence, or casting it under the same head with pastoral: a division by no means proper, unless we suppose the style of a husbandman ought to be imitated in a Georgic, as that of a shepherd is in a Pastoral. But, though the scene of both these poems lies in the same place, the speakers in them are of a quite different character, since the precepts of husbandry are not to be delivered with the simplicity of a ploughman, but with the address of a poet. No rules, therefore, that relate to pastoral, can any way affect the Georgics, which fall under that class of poetry which consists in giving plain and direct instructions to the reader; whether they be moral duties, as those of Theognis and Pythagoras, or philosophical speculations, as those of Aratus and Lucretius, or rules of practice, as those of Hesiod and Virgil. Among these different kinds of subjects, that which the Georgic goes upon, is, I think, the meanest and least improving, but the most pleasing and delightful. Precepts of morality, besides the natural corruption of our tempers, which makes us averse to them, are so abstracted from ideas of sense, that they seldom give an opportunity for those beautiful descriptions and images which are the spirit and life of poetry. Natural philosophy has indeed sensible objects to work upon; but then it often puzzles the reader with the intricacy of its notion, and perplexes him with the multitude of its disputes. But this kind of poetry I am now speaking of, addresses itself wholly to the imagination: it is altogether conversant among the fields and woods, and has the most delightful part of nature for its province. It raises in our minds a pleasing variety of scenes and landscapes, whilst it teaches us, and makes the driest of its precepts look like a description. A Georgic therefore is some part of the science of husbandry put into a pleasing dress, and set off with all the beauties and embellishments of poetry. Now, since this science of husbandry is of a very large extent, the poet shows his skill in singling out such precepts to proceed on, as are useful, and at the same time most capable of ornament. Virgil was so well acquainted with this secret, that, to set off his Georgic, he has run into a set of precepts, which are almost foreign to his subject, in that beautiful account he gives us of the signs in nature, which precede the changes of the weather.
  • 50. And, if there be so much art in the choice of fit precepts, there is much more required in the treating of them, that they may fall in after each other by a natural unforced method, and show themselves in the best and most advantageous light. They should all be so finely wrought together in the same piece, that no coarse seam may discover where they join; as, in a curious brede of needle- work, one colour falls away by such just degrees, and another rises so insensibly, that we see the variety, without being able to distinguish the total vanishing of the one from the first appearance of the other. Nor is it sufficient to range and dispose this body of precepts into a clear and easy method, unless they are delivered to us in the most pleasing and agreeable manner: for there are several ways of conveying the same truth to the mind of man; and to chuse the pleasantest of these ways, is that which chiefly distinguishes poetry from prose, and makes Virgil's rules of husbandry pleasanter to read than Varro's. Where the prose-writer tells us plainly what ought to be done, the poet often conceals the precept in a description, and represents his countryman performing the action in which he would instruct his reader. Where the one sets out, as fully and distinctly as he can, all the parts of the truth which he would communicate to us, the other singles out the most pleasing circumstance of this truth, and so conveys the whole in a more diverting manner to the understanding. I shall give one instance, out of a multitude of this nature, that might be found in the Georgics, where the reader may see the different ways Virgil has taken to express the same thing, and how much pleasanter every manner of expression is, than the plain and direct mention of it would have been. It is in the Second Georgic, where he tells us what trees will bear grafting on each other: Et sæpe alterius ramos impune videmus Vertere in alterius, mutatamque insita mala Ferre pyrum, et prunis lapidosa rubescere corna. —Steriles platani malos gessere valentes: Castaneæ fagus, ornusque incanuit albo Flore pyri; glandemque sues fregere sub ulmis.
  • 51. ----Nec longum tempus; et ingens Exiit ad cælum ramis felicibus arbos; Miraturque novas frondes, et non sua poma. Here, we see, the poet considered all the effects of this union between trees of different kinds, and took notice of that effect which had the most surprise, and by consequence the most delight in it, to express the capacity that was in them of being thus united. This way of writing is every where much in use among the poets, and is particularly practised by Virgil, who loves to suggest a truth indirectly, and, without giving us a full and open view of it, to let us see just so much as will naturally lead the imagination into all the parts that lie concealed. This is wonderfully diverting to the understanding, thus to receive a precept, that enters, as it were, through a by-way, and to apprehend an idea that draws a whole train after it. For here the mind, which is always delighted with its own discoveries, only takes the hint from the poet, and seems to work out the rest by the strength of her own faculties. But, since the inculcating precept upon precept will at length prove tiresome to the reader, if he meets with no entertainment,—the poet must take care not to encumber his poem with too much business, but sometimes to relieve the subject with a moral reflection, or let it rest a while for the sake of a pleasant and pertinent digression. Nor is it sufficient to run out into beautiful and diverting digressions, (as it is generally thought,) unless they are brought in aptly, and are something of a piece with the main design of the Georgic: for they ought to have a remote alliance at least to the subject, that so the whole poem may be more uniform and agreeable in all its parts. We should never quite lose sight of the country, though we are sometimes entertained with a distant prospect of it. Of this nature are Virgil's descriptions of the original of agriculture, of the fruitfulness of Italy, of a country life, and the like, which are not brought in by force, but naturally rise out of the principal argument and design of the poem. I know no one digression in the Georgics that may seem to contradict this observation, besides that in the latter end of the first book, where the poet launches out into a
  • 52. discourse of the battle of Pharsalia, and the actions of Augustus: but it is worth while to consider how admirably he has turned the course of his narration into its proper channel, and made his husbandman concerned even in what relates to the battle, in those inimitable lines: Scilicet et tempus veniet, cum finibus illis Agricola, incurvo terram molitus aratro, Exesa inveniet scabrâ rubigine pila, Aut gravibus rastris galeas pulsabit inanes, Grandiaque effossis mirabitur ossa sepulcris. And afterwards, speaking of Augustus's actions, he still remembers, that agriculture ought to be some way hinted at throughout the whole poem: ----Non ullus aratro Dignus honos: squalent abductis arva colonis; Et curvæ rigidum falces conflantur in ensem. We now come to the style which is proper to a Georgic; and indeed this is the part on which the poet must lay out all his strength, that his words may be warm and glowing, and that every thing he describes may immediately present itself, and rise up to the reader's view. He ought, in particular, to be careful of not letting his subject debase his style, and betray him into a meanness of expression, but every where to keep up his verse in all the pomp of numbers, and dignity of words. I think nothing, which is a phrase or saying in common talk, should be admitted into a serious poem; because it takes off from the solemnity of the expression, and gives it too great a turn of familiarity. Much less ought the low phrases and terms of art, that are adapted to husbandry, have any place in such a work as the Georgic, which is not to appear in the natural simplicity and nakedness of its subject, but in the pleasantest dress that poetry can bestow on it. Thus Virgil, to deviate from the common form of
  • 53. words, would not make use of tempore, but sidere, in his first verse, and every where else abounds with metaphors, Grecisms, and circumlocutions, to give his verse the greater pomp, and preserve it from sinking into a plebeian style. And herein consists Virgil's master-piece, who has not only excelled all other poets, but even himself, in the language of his Georgics, where we receive more strong and lively ideas of things from his words, than we could have done from the objects themselves; and find our imaginations more affected by his descriptions, than they would have been by the very sight of what he describes. I shall now, after this short scheme of rules, consider the different success that Hesiod and Virgil have met with in this kind of poetry, which may give us some further notion of the excellence of the Georgics. To begin with Hesiod:—If we may guess at his character from his writings, he had much more of the husbandman than the poet in his temper: he was wonderfully grave, discreet, and frugal: he lived altogether in the country, and was probably, for his great prudence, the oracle of the neighbourhood.—These principles of good husbandry ran through his works, and directed him to the choice of tillage and merchandize, for the subject of that which is the most celebrated of them. He is every where bent on instruction, avoids all manner of digressions, and does not stir out of the field once in the whole Georgic. His method, in describing month after month, with its proper seasons and employments, is too grave and simple; it takes off from the surprise and variety of the poem, and makes the whole look but like a modern almanack in verse. The reader is carried through a course of weather, and may beforehand guess whether he is to meet with snow or rain, clouds or sunshine, in the next description. His descriptions, indeed, have abundance of nature in them; but then it is nature in her simplicity and undress. Thus, when he speaks of January,—The wild beasts, says he, run shivering through the woods, with their heads stooping to the ground, and their tails clapt between their legs; the goats and oxen are almost flayed with cold: but it is not so bad with the sheep, because they have a thick coat of wool about them. The old men too
  • 54. are bitterly pinched with the weather: but the young girls feel nothing of it, who sit at home with their mothers by a warm fire- side. Thus does the old gentleman give himself up to a loose kind of tattle rather than endeavour after a just poetical description. Nor has he shown more of art or judgment in the precepts he has given us, which are sown so very thick, that they clog the poem too much, and are often so minute and full of circumstances, that they weaken and unnerve his verse. But, after all, we are beholden to him for the first rough sketch of a Georgic; where we may still discover something venerable in the antiqueness of the work: but, if we would see the design enlarged, the figures reformed, the colouring laid on, and the whole piece finished, we must expect it from a greater master's hand. Virgil has drawn out the rules of tillage and planting into two books, which Hesiod has dispatched in half a one; but has so raised the natural rudeness and simplicity of his subject with such a significancy of expression, such a pomp of verse, such variety of transitions, and such a solemn air in his reflections, that, if we look on both poets together, we see in one the plainness of a downright countryman, and, in the other, something of a rustic majesty, like that of a Roman dictator at the plough-tail. He delivers the meanest of his precepts with a kind of grandeur: he breaks the clods, and tosses the dung about, with an air of gracefulness. His prognostications of the weather are taken out of Aratus, where we may see how judiciously he has picked out those that are most proper for his husbandman's observation; how he has enforced the expression, and heightened the images, which he found in the original. The Second Book has more wit in it, and a greater boldness in its metaphors, than any of the rest. The poet, with a great beauty, applies oblivion, ignorance, wonder, desire, and the like, to his trees. —The last Georgic has, indeed, as many metaphors, but not so daring as this; for human thoughts and passions may be more naturally ascribed to a bee, than to an inanimate plant. He who reads over the pleasures of a country life, as they are described by
  • 55. Virgil in the latter end of this book, can scarce be of Virgil's mind in preferring even the life of a philosopher to it. We may, I think, read the poet's clime in his description; for he seems to have been in a sweat at the writing of it: ----O! qui me gelidis in vallibus Hæmi Sistat, et ingenti ramorum protegat umbrâ!— and is every where mentioning, among his chief pleasures, the coolness of his shades and rivers, vales and grottoes, which a more northern poet would have omitted for the description of a sunny hill, and fire-side. The Third Georgic seems to be the most laboured of them all: there is a wonderful vigour and spirit in the description of the horse and chariot-race. The force of love is represented in noble instances, and very sublime expressions. The Scythian winter-piece appears so very cold and bleak to the eye, that a man can scarce look on it without shivering. The murrain, at the end, has all the expressiveness that words can give. It was here that the poet strained hard to out-do Lucretius in the description of his plague: and, if the reader would see what success he had, he may find it at large in Scaliger. But Virgil seems no where so well pleased, as when he is got among his Bees in the Fourth Georgic; and ennobles the actions of so trivial a creature, with metaphors drawn from the most important concerns of mankind. His verses are not in a greater noise and hurry in the battles of Æneas and Turnus, than in the engagement of two swarms. And as, in his Æneïs, he compares the labours of his Trojans to those of bees and pismires, here he compares the labours of the bees to those of the Cyclops. In short, the last Georgic was a good prelude to the Æneïs, and very well showed what the poet could do in the description of what was really great, by his describing the mock grandeur of an insect with so good a grace. There is more pleasantness in the little platform of a garden, which he gives us about the middle of this book, than in all the spacious walks and water-works of Rapin. The speech of Proteus, at the end,
  • 56. can never be enough admired, and was indeed very fit to conclude so divine a work. After this particular account of the beauties in the Georgics, I should, in the next place, endeavour to point out its imperfections, if it has any. But, though I think there are some few parts in it that are not so beautiful as the rest, I shall not presume to name them, as rather suspecting my own judgement, than I can believe a fault to be in that poem, which lay so long under Virgil's correction, and had his last hand put to it. The First Georgic was probably burlesqued in the author's life-time; for we still find in the scholiasts a verse that ridicules part of a line translated from Hesiod—Nudus ara, sere nudus: And we may easily guess at the judgment of this extraordinary critic, whoever he was, from his censuring this particular precept. We may be sure Virgil would not have translated it from Hesiod, had he not discovered some beauty in it; and indeed the beauty of it is, what I have before observed to be frequently met with in Virgil, the delivering the precept so indirectly, and singling out the particular circumstance of sowing and ploughing naked, to suggest to us, that these employments are proper only in the hot season of the year. I shall not here compare the style of the Georgics with that of Lucretius, (which the reader may see already done in the preface to the second volume of Miscellany Poems,) but shall conclude this poem to be the most complete, elaborate, and finished piece of all antiquity. The Æneïs, indeed, is of a nobler kind; but the Georgic is more perfect in its kind. The Æneïs has a greater variety of beauties in it; but those of the Georgic are more exquisite. In short, the Georgic has all the perfection that can be expected in a poem written by the greatest poet in the flower of his age, when his invention was ready, his imagination warm, his judgment settled, and all his faculties in their full vigour and maturity. FOOTNOTES:
  • 57. [3] Addison had already distinguished himself as a man of letters, and as an admirer of Dryden, by a copy of verses addressed to our author, and by a translation of the Fourth Book of the Georgics, exclusive of the story of Aristæus. This last performance is liberally commended by Dryden in the Postscript to Virgil. The following Essay, which has been much admired for judicious criticism contained in elegant language, was sent by him to our author, but without permission to prefix the writer's name. This circumstance led Tickell to throw some reflection on Dryden, as if he had meant to assume to himself the merit of the composition. This charge was refuted by Steele, in a letter to Congreve, prefixed to an edition of the comedy of The Drummer, in 1722, who proves, that the Essay was the same paper which Dryden calls the Preface to the Georgics, and which he acknowledges to have been sent by a friend, whose name he was not at liberty to make public. See the article Addison in the Biographia Britannica.
  • 59. GEORGICS. BOOK I. ARGUMENT. The poet, in the beginning of this book, propounds the general design of each Georgic: and, after a solemn invocation of all the gods, who are any way related to his subject, he addresses himself, in particular, to Augustus, whom he compliments with divinity; and, after, strikes into his business. He shows the different kinds of tillage proper to different soils; traces out the original of agriculture; gives a catalogue of the husbandman's tools; specifies the employments peculiar to each season; describes the changes of the weather, with the signs in heaven and earth that forbode them; instances many of the prodigies that happened near the time of Julius Cæsar's death; and shuts up all with a supplication to the gods for the safety of Augustus, and the preservation of Rome.[4] What makes a plenteous harvest, when to turn The fruitful soil, and when to sow the corn; The care of sheep, of oxen, and of kine, And how to raise on elms the teeming vine; The birth and genius of the frugal Bee, I sing, Mæcenas, and I sing to thee. Ye deities! who fields and plains protect, Who rule the seasons, and the year direct,
  • 60. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookfinal.com