Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6352165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:09:01+00:00 2026-05-24T22:09:01+00:00

I am using MyFaces 1.2 along with Tomahawk for some additional components. For this

  • 0

I am using MyFaces 1.2 along with Tomahawk for some additional components. For this particular page, I needed to use a dataList (instead of a dataTable) because I for every item in my collection i need to display multiple rows (so I am unable to use dataTable).

i tried using rowClasses but that doesn’t work (i think because i am generating the rows myself). I also tried binding the rows to a backing bean but that seems to occur only 1x, not for each item.

Any idea how to best implement this using JSF?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:09:02+00:00Added an answer on May 24, 2026 at 10:09 pm

    Unfortunately, the <t:dataList> has no varStatus concept similar to <c:forEach> and <ui:repeat>. You would otherwise be able to do something like this:

    <table id="mytable">
        <c:forEach items="#{bean.items}" var="item" varStatus="loop">
            <tr>
                <td class="#{loop.index % 2 == 0 ? 'even' : 'odd'}">
                    <h:outputText value="#{item}" />
                </td>
            </tr>
        </c:forEach>
    </table>
    

    with

    #mytable tr.odd { background-color: #ddd; }
    #mytable tr.even { background-color: #eee; }
    

    If <c:forEach> is not an option for you due to technical limitations as it’s a view build time tag, not a render time tag, and you’re using Facelets instead of JSP, then you should be able to use <ui:repeat> following a similar syntax with the only difference that you need to use value attribute instead of items.

    <table id="mytable">
        <ui:repeat value="#{bean.items}" var="item" varStatus="loop">
            <tr>
                <td class="#{loop.index % 2 == 0 ? 'even' : 'odd'}">
                    <h:outputText value="#{item}" />
                </td>
            </tr>
        </ui:repeat>
    </table>
    

    But if you aren’t using Facelets (even though your previous questions suggests that you’re using Facelets), then your best bet is using the CSS3 nth-child pseudoselector.

    #mytable tr:nth-child(odd) { background-color: #ddd; }
    #mytable tr:nth-child(even) { background-color: #eee; }
    

    But if the webbrowser used by your target audience doesn’t support CSS3 (IE8 and older), then you need to resort to JavaScript/jQuery to add the CSS class during document load.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MyFaces 1.1.7 with Facelets and Tomahawk. When creating a regular data table,
I am using JSF Myfaces Impl 1.2 without tomahawk and other libs : I
I have developed web applications using JSF (myfaces components). But in these days of
I'm facing some problems using CDATA blocks inside h:outputscripts with MyFaces 2.0... but I
I'm out of ideas for my exception handling... Using: <myfaces.version>2.0.11</myfaces.version> <richfaces.version>4.1.0.Final</richfaces.version> <tomahawk.version>1.1.11</tomahawk.version> <weld.version>1.1.4.Final</weld.version> <codi.version>1.0.3</codi.version>
I'm trying to create a paginated, sortable datatable using MyFaces . The sorting works
This is a follow-up to what I was trying to accomplish here https://stackoverflow.com/questions/7313922/uploading-files-ussing-myfaces-tomahawk-jsf-2-0 I've
I have a JSF page (using MyFaces 2.0) that does a bit of data
I am using the Apache MyFaces Commons Validator TagLib. How should i add this
Using PyObjC , you can use Python to write Cocoa applications for OS X.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.