Search code examples
javajsfiteratorrichfaces

How can I iterate over java Iterable using RichFaces 'repeat' tag?


In Java, I'm able to use for-loops to iterate over ArrayLists or Iterables. In RichFaces, I can use the facelet "repeat" tag to iterate over ArrayLists, but not Iterables. The error messages I get from using an Iterable are that the attributes or methods of the items in the Iterable cannot be found. How should I code an Iterable so that RichFaces sees the items in it as their proper class, just as Java itself does?


Solution

  • Based on org.richfaces.component.UISequence#createFacesModel valid types for value attribute of a4j:repeat (and other RichFaces data iteration components (rich:list, rich:dataTable, etc.)) are the following:

    javax.faces.model.DataModel
    java.util.List
    java.lang.Object[]
    java.sql.ResultSet
    javax.servlet.jsp.jstl.sql.Result
    

    So, in your case iterables should implement java.util.List interface.