title: How to create a foor-loop in primefaces/jsf form panel?
body: <p>I have a primefaces panel, where I want to offer primefaces' <code>p:fileUploader</code> for several elements. During runtime it is not clear, how many items there will be. This is my code:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;p:panel id="grid" header=""&gt;
          &lt;h:panelGrid columns="2" cellpadding="5"&gt;
  
              &lt;c:forEach items="${bean.testCurrent}"
                  var="car" varStatus="i"&gt;
                  &lt;p:outputLabel value="#{car.name}: " for="image${i.index}" /&gt;
                  &lt;p:column&gt;
                      &lt;p:fileUpload id="image${i.index}"
                          fileUploadListener="#{bean.uploadImage}"
                          mode="advanced" dragDropSupport="true" multiple="false"
                          update="messages" sizeLimit="1000000"
                          allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
                          oncomplete="disableChoosing()"/&gt;
                      &lt;p:growl id="growl" showDetail="true" /&gt;
                  &lt;/p:column&gt;
              &lt;/c:forEach&gt;
  
          &lt;/h:panelGrid&gt;
          &lt;p:commandButtonaction="#{bean.save()}" value="Save" /&gt;
          &lt;p:commandButton action="#{bean.cancel()}"  value="Cancel" /&gt;
      &lt;/p:panel&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>So my first step was trying it with JSTL's <code>c:forEach</code>. This doesn't work, because JSTL runs during build time of the view and JSF runs during render time of the view component tree.</p>
  
  <p>Is there a possibility to implement a for-loop in the panel or is there any other possibility to display the form elements dynamically?</p>