日期:2014-05-18  浏览次数:20768 次

jsp分类显示问题
显示出来是这个样子

分类1 分类1 
资源 资源 

分类2 分类2 
资源 资源 

分类3 分类3 
资源 
资源 

我想让页面这样显示

分类1 分类2
资源 资源

分类3
资源
 
 
ivo.getName()是分类.
 


代码如下
<html>
<head>
<base href="<%=basePath%>">

<title>
My JSP 'ShowAllSourceInfo.jsp' starting page
</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
  <link rel="stylesheet" type="text/css" href="styles.css">
  -->
</head>

<body>
<TABLE>

<%ArrayList al = (ArrayList) request.getAttribute("list");
if (al != null) {
 
Iterator it = al.iterator();
while (it.hasNext()) {
ItemVo ivo = (ItemVo) it.next();
%>
<tr>
<td>
<table><tr><td><%=()%></td></tr>
<tr><td>资源</td></tr>
</table>
</td>
<td>
<TABLE>
<tr><td><%=ivo.getName()%></td></tr>
<tr><td>资源</td></tr>
</TABLE>
</td>
</tr>
<%}
} else {%>
<jsp:forward page="../SearchSourceInfoServlet?type=selectclass" />
<%}

%>

</TABLE>
</body>

------解决方案--------------------
先对分类进行合并操作,或按分类排序,再生成