I am using ui:repeat tag which render images. I have five images i want that on each iteration my image get ids like image1, image2, image3…. imagen. I tried this but it is not working.
<div id="imageGallery">
<ui:repeat value="#{countryPages_Setup.images}" var="image" varStatus="status">
<tr>
<td>
<a href="javascript:void()" class="launchLink">
<p:graphicImage id="image#{status.index}" //problem
value="/resources/images/#{image}"
width="100"
height="100"
rendered="#{countryPages_Setup.renderImages}"/>
</a>
</td>
</tr>
</ui:repeat>
</div>
I also tried {staus.index + 1}. I also tried id= image#{1++} But it is also not working. How can i do it?
Thanks
You cannot use el expressions within the
idattribute. It needs to be static. Theui:repeatitself generates a prefix to your id. You don’t need to care about uniqueness.So, for instance if you have an
id="image", then the generated ids aresomePrefix:0:image,somePrefix:1:image, …