views:

68

answers:

2

Hi there.

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

A: 

Maybe you could use :dataList instead of :repeat to conditionally output something (class) for the last element, like in the following googled piece of code?

<t:dataList rowCountVar="rowCount" rowIndexVar="rowIndex">
  <h:outputText value="," rendered="#{(rowCount-1)!=rowIndex}"> 
</t:dataList>
Kamil Szot
A: 

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

João Madureira Pires