Eclipse IDE for Java EE provides project facets for various types of projects. In Chapter 1, EJB 3.0 Database Persistence, we used the EJB Module project facet and the JPA project facet to create an EJB project. In Chapter 2, O/X Mapping with JAXB 2.x, we used the JAXB project facet to create a JAXB project. In this chapter, we shall discuss a more generic project facet for web applications called the Dynamic Web Module project facet that adds support for Java Servlet API to build web applications. To demonstrate the use of the Dynamic Web project, we shall be using JasperReports as an example. Preparing presentation-quality reports is a routine occurrence, and several tools and APIs for creating reports are available. For Java developers, one of the most commonly used API is JasperSoft's open source JasperReports, which is capable of producing a range of outputs, including HTML, PDF, and presentations from either static data or data retrieved from a database table using a SQL query, and is designed to be integrated directly into Java/J2EE applications.
This chapter sets out to demonstrate the essentials of how JasperReports can be used in a web application created with Eclipse. The examples created in this chapter are a PDF report and an Excel report. This chapter has the following sections:
Setting the environment
Creating a Dynamic Web project in Eclipse
Creating the configuration file
Creating a web application
Packaging and deploying the web application
Running the web application