Integrating JasperReports with JSF

JavaServer Faces (JSF) is the standard technology for developing user interfaces for Java server applications. In theory, JSF is view technology agnostic (that is, it can be used to develop user interfaces for a variety of technologies). However, in practice, JSF is almost always used to develop web applications.

JSF applications typically consist of JSP and backing beans, with the latter serving as controllers for the former. JSF and JasperReports integration can be accomplished by creating a backing bean that will generate a report. The following example illustrates this technique:

package net.ensode.jsf; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; ...

Get JasperReports 3.5 for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.