我正在尝试制作具有不同颜色的奇数行和偶数行。这是我的代码:
<h:head>
<h:outputStylesheet library="css" name="styles.css" />
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<h:dataTable id="accountsTable" value="#{currentCustomer.accounts}" var="accounts" styleClass="accountsTable" headerClass="accountsTableHeader" rowClasses="accountsTableOddRow,accountsTableEvenRow" >
<h:column>
<f:facet name="header">Account Number</f:facet>
#{accounts.accountNumber}
</h:column>
<h:column>
<f:facet name="header">Currency</f:facet>
#{accounts.accountCurrency}
</h:column>
<h:column>
<f:facet name="header">IBAN</f:facet>
#{accounts.iban}
</h:column>
<h:column>
<f:facet name="header">Account Number</f:facet>
#{accounts.accountNumber}
</h:column>
</h:dataTable>
</h:form>
</h:body>
和css文件:
root {
display: block;
}
.accountsTable{
border-collapse:collapse;
border:1px solid #000000;
background-color: red;
}
.accountsTableHeader{
background:none repeat scroll 0 0 #B5B5B5;
border-bottom:1px solid #000000;
padding:2px;
}
.accountsTableOddRow{
text-align:center;
background:none repeat scroll 0 0 #FFFFFFF;
}
.accountsTableEvenRow{
text-align:center;
background:none repeat scroll 0 0 #D3D3D3;
}
我的文件组织:
但所有行仍然是白色的。谁能帮我这个?
谢谢