Collection Data Source

Introduction

Collection data source is used to import data from a Collection on a JSP page. The objects in the Collection are mapped to data values.

Setup

The Collection can be constructed on a JSP page:

<%
  // list containing average temperatures for the first season
  java.util.List seasonOneMeasurements = new java.util.ArrayList();
  seasonOneMeasurements.add(new Double(17.8));
  seasonOneMeasurements.add(new Double(22.3));
  seasonOneMeasurements.add(new Double(24.5));
  seasonOneMeasurements.add(new Double(23.1));
%>

The collection where data is to be imported from should be added to the servlet request object using:

<%
request.setAttribute("season1", seasonOneMeasurements); 
%>

The given name is used to identify the collection in chart configuration.

Examples

Assume that one has a dataBean having properties salesPersons and sales. Methods getSalesPersons() and getSales() returns a java Collection.

<data>
  <collection source="season1">
    <collectionColumn name="summer" />
  </collection>
</data>

The above example would import season one measurements to one column.

Average temperatures from a single collection on a JSP page.
Multiple collections.