repeat « Facelets « JSF Q&A

1. How do I know which element is clicked in ui:repeat?

In JSF, we can bind HtmlDataTable to backing bean and get the row data. But ui:repeat doesn't even have a binding attribute. So, how do I know which row (element) is ...

2. Dynamic ui:include inside ui:repeat. Is there a simple solution?

I want to dynamically pick a facelet to render some item in my data list. The first try would be:

<ui:repeat value="#{panels}" var="panel">
  <ui:include src="#{panel.facelet}">
But it won't work since src of ...

3. JSF: value bindings inside nested ui:repeat

I have a strange problem with the <ui:repeat> tag. Even for my very simple example, value bindings inside nested repeat components do not work as expected. I have a simple facelet like ...

4. JSF / Mojarra 2.0.2: ui:repeat is totally broken when updating via AJAX

Using ui:repeat for simple listing of elements produces very strange results - when you add an element, the first element is always replaced with the values from the last element before ...

5. how to parse the value to integer in ?

I have a code like this:

<ui:repeat value="#{myController.fileList}}"  var="element" >
<t:inputFileUpload value="#{myController.uploadedFile[element]}"  />
but this returns an error : java.lang.NumberFormatException: For input string: "[0]}". UploadedFile is an array of Files. When i ...

6. Nested ajax in JSF and ui:repeat

        <h:selectManyListbox id="listbox" value="#{form.items}">
            <f:selectItems value="#{form.allItems}">

7. How to break in a

Is there any easy way I can break in a ui:repeat loop ? I'm trying to do it the following way, but it does not work. The idea is to print the ...

8. Facelets repeat Tag Index

Does anyone know a way to get the index of the element in a ui:repeat facelets tag?

<ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.topDreams}">
    <h:outputText class="dream-title uppercase" value="#{dream.number}. #{dream.title}" />

9. jsf ui:repeat with multiple items in row

Is it possible to iterate over collection and display multiple items in a row? Something like:

<ui:repeat value="#{c.images}" var="img" step="3">
#{img} #{img+1} #{img+2}<br/><br/>