How to dynamically generate id in dataTable using ui:repeat tag

后端 未结 4 486
天命终不由人
天命终不由人 2021-01-07 03:23

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 i

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-07 04:10

    But you can use variable in Javascript, for example:

    
    

    You can also use Variables with event handlers (since JSF 2.0):

    
    

    But your loop with c:forEach can cause problems. Be aware that the JSTL tags (everything that begins with c:) are not fully compatible to JSF. If you have luck, then they work as expected. But anyways the slow down the rendering engine, since the page gets processed multiple times by the JSF and JSP rendering engine.

    Better use ui:repeat.

提交回复
热议问题