如何用struts实现阴阳色列表?

elaine182 2003-06-09 06:53:46
struts本身有带实现阴阳色列表(就象CSDN论坛的列表一样)的标记吗?如果没有应该如何实现???
...全文
25 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
accp 2003-06-15
  • 打赏
  • 举报
回复
CSDN用的是样式表,我觉得还是用样式表方便,程序不用考虑颜色,只要动态调用不同的样式表就行了~
bigbigstone 2003-06-15
  • 打赏
  • 举报
回复
<!--loop begin-->
<%
int i=1;
String[] bgcolors={TD_BGCOLOR,TD_BGCOLOR2};
Iterator messages=topicBean.getMessages().iterator();
while(messages.hasNext()){
Message message=(Message)messages.next();
i=1-i;
%>
<tr class="aa">
<td bgcolor="<%=bgcolors[i]%>" valign="top" cellpadding="5">
  <%=StringUtil.escapeHTMLTags(message.getU_name())%><BR>
  <!-- Registered: <BR>- --><%=DateTimeUtil.shortFmt(message.getU_regtime())%>
</td>
<td bgcolor="<%=bgcolors[i]%>" >
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="aa">
  
<%if(message.getM_iconid()>0){%><img src="img/icons/<%=message.getM_iconid()%>.gif" width=15 height=15 border="0"><%}%>
 <%=DateTimeUtil.shortFmt(message.getM_time())%>
</td>

</tr>
<tr>
<td colspan="2" height="1" bgcolor="#999999" class="aa">
</td>
</tr>
<tr>
<td colspan="2" valign="top" class="aa">
<BR>
<p>
<%=StringUtil.dspHtml(message.getM_content())%>
</p>

</td>
</tr>
<tr>
<td colspan="2" height="1" bgcolor="#999999">
</td>
</tr>
</table>
</td>
</tr>
<%
}
%>
<!--loop end-->
Gemini_h 2003-06-15
  • 打赏
  • 举报
回复
学习
phoenixtree 2003-06-14
  • 打赏
  • 举报
回复
自己写个tag不就解决了吗?
elaine182 2003-06-14
  • 打赏
  • 举报
回复
不是树型,象xiaoyou(三尺剑)所说的我也会,但我不希望把逻辑判断放到页面上,有办法既利用struts又不需要放任何逻辑判断到JSP页面上就可以实现这种“阴阳色列表”吗??

在整个网站里,我希望在JSP页面里仅仅放扩展标记,所有接口和判断都用类来完成
yangjuanli 2003-06-09
  • 打赏
  • 举报
回复
楼主的“阴阳色列表”指的是树型目录吗?
  • 打赏
  • 举报
回复
<logic:iterate id="headInfo" name="customerForm" property="cusHeadListInfo.cusHeadInfo" indexId="index" offset="<%= nowPageRecOffset.toString() %>" length="<%= nowPageRecCnt.toString() %>">
<%
int pageIndex = index.intValue();
int indexMod = (pageIndex % 2);
String bgColor = "";
if (indexMod == 0) {
bgColor = "";
}
else{
bgColor = "BGCOLOR=\"#CCCCCC\"";
}
%>

<TD <%=bgColor%> WIDTH="70" class="list">
<bean:write name="headInfo" property="custId"/>
</TD>
<TD <%=bgColor%> WIDTH="100" class="list">
<bean:write name="headInfo" property="lastName"/><bean:write name="headInfo" property="firstName"/>
</TD>
<TD <%=bgColor%> WIDTH="130" class="list">
<bean:write name="headInfo" property="commissionName"/>
</TD>

</logic:iterate>

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧