<ui:repeat value="#{prodCtr.paginator.model}" var="o">
<h:form>
<h:commandLink id="#{o.id}" action="ModelInfo.xhtml" actionListener="#{prodCtr.listener}">
<h:panelGrid columns="1" style="border: #ffffff">
<img src="resources/images/#{o.id}.jpg" style="width: 100px;height: 100px"/>
<h:outputLabel value="#{o.price} YTL" style="font-size: 12px;font-family: Georgia, Serif;color: #ff3300" />
<h:commandButton value="Sifaris et" class="button"/>
</h:panelGrid>
</h:commandLink>
</h:form>
</ui:repeat>
java.lang.IllegalArgumentException caught during processing of RENDER_RESPONSE 6 : UIComponent-ClientId=, Message=Empty id attribute is not allowed here
How can i CommandLink id dinamically?Is there an other way?
You don't need to specify the
id
attribute for the child components when using the<ui:repeat/>
tag. It automatically does this.If you do want to be in control of the
id
attribute,<ui:repeat/>
is the wrong one to use for that. The reason is that at point in time that the components are being placed in theUIViewroot
(essentially when the page is being constructed for the first time), the<ui:repeat/>
component is not active, i.e. it's not being processed. So thevar="o"
is not available to the runtime and so nothing is available to be used asid
.To be in control of the
id
, you should be using the<c:forEach/>
tag instead. Your code should look like this: