<table width="90%" border="0" cellspacing="3" cellpadding="3" align="center" id="_ga1">
<tr>
<c:forEach var="g" items="${gamecome}" varStatus="st">
<td>
<a href="<%=request.getContextPath() %>/article/showGameTypes.do?pid=${g.sourceType.id }"> ${g.name }</a>
</td>
<c:if test="${(st.count % 3) eq '0'}"></tr></c:if>
</c:forEach>
<tr>
</tr>
</table>
如果是用无敌%的话,如下:
if(list != null && list.size() > 0){
%>
<table cellpadding="0" cellspacing="3" width="100%">
<tr>
<%
for(int i =0 ; i < list.size(); i ++){
SourceType type = (SourceType)list.get(i);
if(i !=0){
if (i %3 == 0) {
%>
</tr><tr>
<%
}else{
%>
<td></td> //中间留点空隙
<%
}
}
%>
<td width="48%">
<a href="<%=request.getContextPath() %>/article/showGameTypes.do?pid=<%=SourceType.GAMESYSTEM %>"><%=type.getName() %></a>
<td>
<%
}
%>
</tr>
</table>
<%
}
%>