1

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

1
  • What JSF libraries/frameworks are you using? What view technology (JSP/Facelets)? Commented Oct 28, 2009 at 13:47

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.