Css – Change dynamically css class

cssjsf

Imagine that i have the following code:

<a:repeat value="#{bean.getList()}" var="x" >
   <li class="la">
      <span>
        <img src="#{bean.getThumbImageUrl(x)}"/>
       </span>
   </li>
</a:repeat>

I'm receiving a List of elements on bean.getList(). For each element, i'm getting it's image and print it. On the <li> tag, i'm defining a specific class. What i need it's to apply a different class to the last element of bean.getList().

Does anyone knows how to do it?

Thanks

Best Answer

Just found the solution:

<a:repeat value="#{bean.getList()}" var="x" rowKeyVar="row"> <li class="#{row==<numberOfElements>?'lala':''}"> <span> <img src="#{bean.getThumbImageUrl(x)}"/> </span> </li> </a:repeat>

Thanks for your help Kamil Szot