listformattingtagsicefaces

Output List content using ICEFaces


I want to show a List using ICEFaces, and I want to output it like:
TAG1, TAG2, TAG3.

But without using , or <% for (...) { ... } %>, is there a way to do this?
Thanks!


Solution

  • ICEfaces doesn't provide any mechanism for putting "logic" inside views (the rendered property is the only kind-of way).

    However, I would propose you to take a look at two other JSF tags: c:forEach and ui:repeat

    You'll find them in the following two namespaces:

    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jstl/core"
    

    There are fundamental differences, since c:forEach is a TagHandler and ui:repeat a Component. It will basically depend on the content you want to output within the loop, which way you choose. They'll be evaluated at different phases when the view is built.

    I'd recommend a blog post by Roger Keays which compares c:forEach and ui:repeat and lists some typical issues:

    Roger Keays, 2007. c:forEach vs ui:repeat in Facelets


    Update: There's the ice:panelSeries component which iterates over a given collection of objects.

    <ice:panelSeries var="item" value="#{myList}">
       <h:outputText value="#{item.printThisText}"/>
    </ice:panelSeries>