下面是logic:iterate的具体内容,kensakuBeans为传过来的一个链表,如何实现让显示出来的数据隔行的颜色不一样,比如说第一行无背景色,第二行红色,第三行我背景色,第四行又是红色......
<logic:iterate id="kensaku" name="kensakuBeans">
<tr>
<td class="settle1"><bean:write name="kensaku" property="tesokuNO"/></td>
<td class="settle1" width="600"><bean:write name="kensaku" property="tesokuName"/></td>
<td align="center" class="settle1" colspan="3"><a href="detail.do?tesokuNO=<bean:write name="kensaku" property="tesokuNO"/>">一覧</a> </td> </tr>
</logic:iterate>
<logic:iterate id="kensaku" name="kensakuBeans">
<tr>
<td class="settle1"><bean:write name="kensaku" property="tesokuNO"/></td>
<td class="settle1" width="600"><bean:write name="kensaku" property="tesokuName"/></td>
<td align="center" class="settle1" colspan="3"><a href="detail.do?tesokuNO=<bean:write name="kensaku" property="tesokuNO"/>">一覧</a> </td> </tr>
</logic:iterate>
解决方案 »
- 急啊!!!!!ireport 子报表数据源问题
- 哪些软件公司做银行业务
- 提问:Jbuilder X 开发完后怎样发布、布署在TOMCAT下面?
- session关于cookie与url重写的问题
- 求助,我的html文件为何在weblogic下找不到servlet?
- JSP如何运行外部程序。
- 也许是另类的问题
- 在sqlserver中Procedure有建立临时表,然后再查询这个临时表,在java执行这个Procedure就出错,怎么解决?
- 我在改版 前发的帖子。。现在没了。。///郁闷中。。。
- hibernate 查询数据为什么只会显示第一条?
- red hat 5 ssh的密码如何更改?
- 问卷调查系统设计问卷
<tr bgcolor="<%=(index.intValue() % 2 == 0) ? "red" : "blue"%>">
<td>
aaaaaaaaaa
</td>
</tr>
</logic:iterate>
<%int iRow = 0;%><!--初始化变量-->
<logic:iterate id="history" name="historylist">
<%iRow++; %><!--循环递增-->
<tr <%if(iRow%2==0){%> id="change" <%}%>><!--偶数行改变tr样式-->
#main tr {
background-color:expression((this.sectionRowIndex%2==0)?"#E1F1F1":"#F0F0F0")
}
</style>
<body>
<table class="main"><logic:iterate id="kensaku" name="kensakuBeans">
<tr>
<td class="settle1"> <bean:write name="kensaku" property="tesokuNO"/> </td>
<td class="settle1" width="600"> <bean:write name="kensaku" property="tesokuName"/> </td>
<td align="center" class="settle1" colspan="3"> <a href="detail.do?tesokuNO= <bean:write name="kensaku" property="tesokuNO"/>">一覧 </a> </td> </tr>
</logic:iterate>
</table>
</body>
用css不可以么,为什么要浪费性能在这中上面
如果有100W条数据,就为了这么点小事,就要浪费多少cpu啊~~~~
.main {
color:expression((this.sectionRowIndex%2==0)?"red":"green")
}
</style>
<body>
<table >
<logic:iterate id="kensaku" name="kensakuBeans">
<tr class="main">
<td class="settle1"> <bean:write name="kensaku" property="tesokuNO"/> </td>
<td class="settle1" width="600"> <bean:write name="kensaku" property="tesokuName"/> </td>
<td align="center" class="settle1" colspan="3"> <a href="detail.do?tesokuNO= <bean:write name="kensaku" property="tesokuNO"/>">一覧 </a> </td> </tr>
</logic:iterate>
</table>
</body>
<tr bgcolor=" <%=(index.intValue() % 2 == 0) ? "red" : "blue"%>">
<td class="settle1"> <bean:write name="kensaku" property="tesokuNO"/> </td>
<td class="settle1" width="600"> <bean:write name="kensaku" property="tesokuName"/> </td>
<td align="center" class="settle1" colspan="3"> <a href="detail.do?tesokuNO= <bean:write name="kensaku" property="tesokuNO"/>">一覧 </a> </td> </tr>
</logic:iterate>
然后可以用标签
<logic:iterate id="kensaku" name="kensakuBeans">
<logic:equal name="kensaku" property="rowColor" value="1"><tr bgcolor="#FF0000"></logic:equal>
<logic:equal name="kensaku" property="rowColor" value="0"><tr bgcolor="#FFFFFF"></logic:equal>
.
.
.
.</logic:iterate>
<logic:iterate id="list" name="list" indexId="index">
<c:if test="${index%2 ==0}"
<tr bgcolor="red">
<td>
aaaaaaaaaa
</td>
</tr>
</c:if>
<c:if test="${index%2 !=0}"
<tr bgcolor=" green">
<td>
bbbbbbbbbb
</td>
</tr>
</c:if>
</logic:iterate>