Max Katz heads Developer Relations for, a cloud-based mobile app platform. He loves trying out new and cool REST APIs in mobile apps. Max is the author of two books “Practical RichFaces” (Apress 2008, 2011), and is a frequent speaker at developer conferences. You can find out what Max is up to on his blog: and Twitter: @maxkatz. Max is a DZone MVB and is not an employee of DZone and has posted 90 posts at DZone. You can read more from them at their website. View Full User Profile

Using JSF and Flex Components Together

  • submit to reddit

Using Fiji

There are three basic steps to get started.

  1. Download project template
  2. Download JAR file and add them to project template
  3. Open the project in your favorite IDE

Download Project template

Download and unzip the project template. <link>

Download Fiji JAR files

  1. Go to and click on Download to download Fiji distribution
  2. Unzip the downloaded file
  3. In the next step you are going to copy JAR files from lib folder to fiji/web/WEB-INF/lib directory
    1. If running Tomcat 5.5, copy all files
    2. If you are running Tomcat 6, copy all files except:
    ¦ el-api.1.0.jar
    ¦ el-impl-1.0.jar

Import Project

Import the project into your favorite IDE. Here is how to do it in JBoss Tools (same steps for JBoss Developer Studio).

  1. Select File/Import
  2. Select Other
  3. Select JSF Project
  4. Point to the web.xml file location in the project
  5. Click Next
  6. Keep all setting as they are (I'm assuming you have a server defined)
  7. Click Finish

To tell you the truth, installing Fiji is very simple. It's basically a RichFaces project (has to be RichFaces version 3.2.2 or higher) plus the JAR files for Fiji:

  • fiji-api-1.x.x.jar
  • fiji-ui-1.x.x.jar
  • flamingo-service-jsf-1.6.x.jar - to use HttpService via <fiji:endpoint> component. Covered later in article.

Besides using HttpService, if you would like to use DataServices (AMF format), you need two additional JAR files:

  • amf-serializer-1.6.x.jar

That's it. Nothing else is needed, not even changes to web.xml.

Using Bar Chart

Let's start with a simple example using bar chart. The first step is to create the data for the chart. Because we can easily bind charts to JSF managed beans, that's where we are going to create our data.

The Java bean looks like this:

public class BarChartBean {
public BarChartBean() {
private Integer[] data;

public Integer[] getData() {
return data;
public void init () {
data = new Integer[5];
data[0] = 5;
data[1] = 2;
data[2] = -3;
data[3] = 10;
data[4] = 9;

To make it a JSF managed bean we need to register it in a JSF configuration file:


So far this is just basic JSF. Let's now create the page.

Open start.xhtml. Look at the top, the page already contains a namespace for the Fiji tag library. Insert the following between <body> tags:

<fiji:barChart id="barChart" value="#{}"
title="Bar chart" width="500" height="300">
<fiji:chartData type="name" value="Just some numbers" />

<fiji:barChart> is just like a standard JSF component. The value attribute is bound to chart data inside the managed bean. <fiji:chartData type=”name”..> sets the chart name.

Save everything and run the page. You should get the following:

Published at DZone with permission of Max Katz, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Agata Przybyszewska replied on Mon, 2009/02/02 - 8:19pm

I have tried to follow the tutorial, and make Fiji work with Seam and Flex.

I have tried several approaches:
1) Followed the tutorial  here:
 Result - server crash from the helloworld on page 3 :-(

2) I tried to follow the tutorials advice that fiji is just a rich faces project - just copied the 2 files fiji-api.jar and fiji-ui.jar into the lib
folder of my HelloWorld Seam project, and added the following facelet:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://">
<ui:composition xmlns=""

                <f:facet name="header">
                Ready for Fiji...

                <fiji:swf src="hello.swf" width="400" height="400"

The hello.swf file liest in the same folder as the facelet file.
This didn't crash the server. But the result is not what I wanted - no
Flash component.

 Any ideas what I do wrong?



Joe Greene replied on Tue, 2009/03/03 - 12:47pm

Max -

You give little guidance on how to update an amChart wrapped inside a fiji:swf component.  Looking at the amCharts docs, it looks like the data wants to be either csv or xml format.  If I want to use an am line chart wrapped in the fiji:swf component, I need to know how to bind the chart data to a bean instead of xml or csv data.  Can this be done?  If not, I think this is important and should be stated.

Max Katz replied on Mon, 2009/03/09 - 12:39pm in response to: Joe Greene

For anyone else looking for an answer, Joe posted it here

Santhosh Kumar replied on Wed, 2010/01/06 - 11:23am

your article on fiji chart was great..

I am using fiji line chart.. i need  a help on line chart..

i need to highlight the  y axis based on input given,,,,

for exampl if y-axis value is 45... i want to show highlihted y-axis region 40-50...



thanks in advance... 

Dani Holiday replied on Thu, 2010/02/18 - 4:30am

Hi! I saw that in RichFaces i have to read the data from the xml/csv. I bring the data from the database. if so, how can i integrate RichFaces + AMCharts + reading the data from the database and sending it to the bean? thanks!

Devika Nara replied on Fri, 2010/02/19 - 12:07am

is it possible to add the flex components dynamically to JSF page???

Design Geeks replied on Sat, 2010/02/27 - 12:51am


good example.

I have tried it with Netbeans 6.8 & glassfish 2.0 wirh jsf-richfaces

//jsp code

<%@taglib uri="" prefix="a4j"%>
<%@taglib uri="" prefix="rich"%>

<%@taglib prefix="f" uri=""%>
<%@taglib prefix="h" uri=""%>
<%@taglib prefix="fiji" uri=""%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

<f:view locale="#{skinBean.currentlang}">

            <fiji:stackedColumnChart   id="stackedColumnChart" value="#{}"
                                     title="Simple Stacked Column Chart" subtitle="Display Resolution Statistics"
                                     captionX="Years" captionY="Percent" legendCaption="Resolution"
                                     barColors="#{oneSeriesBar.colors}" width="400" height="400"
                <fiji:chartData type="name" value="#{oneSeriesBar.names}" />

at runtime it gives xml error like Retrieved XML is invalid



any idea?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.