Getting Started

classpath

Chart TagLibs depends on FreeChart and JCommon for rendering the chart and commons-beanutils to work with beans properties. Put these library in your classpath:

WEB-INF

Put this in your web.xml

  <servlet>
    <servlet-name>DisplayChart</servlet-name>
    <servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class>
  </servlet>
  <servlet-mapping>
	<servlet-name>DisplayChart</servlet-name>
	<url-pattern>/servlet/DisplayChart</url-pattern>
  </servlet-mapping>
		
		
Copy chart-tag.tld to WEB-INF directory. Get chart-tag.tld from chart-taglibs-x.x.jar file (unzip).

JSP page

Add the taglib definition to the JSP page

<%@ taglib uri="/WEB-INF/chart-tag.tld" prefix="chart" %>
               
       

Example (Pie Chart)

JSP code:

<chart:pie collection="pieDataSet" category="label" value="value" 
  title="Pie Chart" onlcick="Alert('Hello World Chart TagLibs')" />
               
       
Where pieDataSet is a collection (Vector,ArrayList,..) of a simple JavaBean (POJO) present in any scope (page, request, session, application) , label and value are attribute of this JavaBean with getters and setters. Take a look to the demonstration application for more examples, and see chart-tag.tld for more options.