Usage of the CSV Source

When using this kind of source we can load the data from a resource resolvable through the built-in resource loading mechanism or by means of a backing bean which will offer the data to the source component.

Configuring the source

The attributes required to be used with this type of data soruce are reflected in the following table:

valuefalseFile, URL or resource which contains the data.

Valid types for value attribute are:

  • A file handler to a resource with currently resides at server machine.
  • An URL to a resource which can be obtained through internet
  • A stream usable to read the CSV data. Application will be responsible of closing the provided stream.
  • java.lang.String: A path to any kind of resource. It will be loaded using the built-in resource loading mechanism.


Simple Usage

The most simple usage is based on the built-in resource loading mechanism implemented inside the plugin using following way:

<jr:source type="csv" value="classpath:META-INF/datasource/test.csv" />

Using a backing bean

First of all, we need to design a JSF Managed Bean which will build the CSV data that will be used by the data source component.

import javax.annotation.PreDestroy;

public class CSVDataBean {

    private InputStream csvFile;

    public InputStream getCsvFile() {
        if (csvFile == null) {
            // Obtain a csv file from disk
            csvFile = new FileInputStream( ... );
        return csvFile;

    public void release() {
        if (csvFile != null) {
            try {
            } catch(IOException e) {


Then, this managed bean can be used inside the JSP file that will render the report or report link.

<jr:source type="csv" value="#{CSVDataBean.csvFile}" />

Using Queries

Currently queries against CSV data sources are not supported.