myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Myfaces Wiki] Update of "TrinidadSeamAjax4JsfFaceletDetail" by ThomasHamacher
Date Wed, 28 Feb 2007 13:38:48 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by ThomasHamacher:

New page:
== Configure Trinidad for use with Seam, ajax4jsf  and Facelets ==

In a complex environment with a lot of different libraries to play together and therefor use
the best of all to fullfil your requirements, there are some things to keep in mind. This
is a short description on how I configured my application to make these components run together.

I´m referencing to the following environment:

    * Trinidad Nightly Build from Apache Incubator []
    * JBoss Seam 1.1.6 []
    * Ajax4jsf 1.0.6 []
    * Facelets 1.1.12 []
    * MyFaces 1.1.5 []
    * JBoss Application Server 4.0.5 []

To make Trinidad play together with Ajax4jsf you also have to include the `a4j-trinidad.jar`.
The a4j-trinidad contains an alternative AjaxContext called TrinidadAjaxContext which is not
present in the main distribution, so you will need the extra library additional to the ajax4jsf-library.
You will find this at the ajax4jsf-website as well.

=== faces-config.xml ===
Let´s start with the `faces-config.xml`. It is very neccessary to remove all `view-handler`s
and instead set the `default-render-kit` to Trinidad. Then the faces-config.xml should look
something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"

    <!-- Phase listener needed for all Seam applications -->



=== web.xml ===
Let´s go over to the `web.xml`. First we have to define a special set of `listeners`. I don´t
think the order is that important in this case, but I started with the
SeamListener, which is declared as follows:


Afterward you have to define the listener for your JSF-Implementation. I used MyFaces and
therefor used this declaration:


But if you´re playing with SUN RI, declare it this way:


For the most of the libraries you don´t have to set any special context-parameters, but when
it comes to the Trinidad `context-param`s the following declaration is 


When it comes to the `filter-mapping` the order is very important. You have to define the
ajax4jsf-filter-mapping as the very first one, followed by the others.
This is the sequence I used in my web.xml:

    <!-- ************************ AJAX4JSF Filter **************************** -->
    <!-- If you have other filters declared in the web.xml, be sure that Ajax4jsf Filter
is declared before the others. -->
        <display-name>Ajax4jsf Filter</display-name>
        <servlet-name>Faces Servlet</servlet-name>        
    <!-- ************************ Trinidad Filter **************************** -->
        <servlet-name>Faces Servlet</servlet-name>
    <!-- ************************ Seam Filter **************************** -->
        <filter-name>Seam Exception Filter</filter-name>
        <filter-name>Seam Exception Filter</filter-name>
        <filter-name>Seam Redirect Filter</filter-name>
        <filter-name>Seam Redirect Filter</filter-name>

This is all I did and it works quite nice and smoothly.  

Hope it helps someone to run these great libraries together, which makes development really
smooth and easy.

Have fun!

''Thomas Hamacher''  

View raw message