这样该怎么迭代循环数据?请教了
一个表格2行一列,第一列是2行,第2列合并了2行,然后我循环显示数据,都显示在第一行里面,第2行里面是一张图片,但是我调试了后,每次都是连图片显示或者就是把图片显示在最后一条记录后面,请教应该怎么循环?
要的效果就是第一行很多行数据,第二行只有一张图片!谢谢了!
请看具体代码:
if(list!=null){
for(int i=0;i <list.size();i++){
HashMap hashmap;
hashmap=(HashMap) list.get(i);
String title=(String) hashmap.get( "TITLE ");
String filedir=(String) hashmap.get( "FILEDIR ");
String fileurlname=(String) hashmap.get( "FILEURLNAME ");
String titleshow= " ";
if (title.length()> 30){
titleshow=comment.getSubString(title,30)+ "... ";
}else{ titleshow=title;}
System.out.println(filedir+ "\n "+fileurlname+ "\n "+title);
out.print( " <table border= '1 ' cellspacing= '0 ' cellpadding= '0 ' width= '100% '> ");
out.print( " <tr> ");
out.print( " <td class= 'f12 ' > · <a href= '../f/ "+filedir+ "/ "+fileurlname+ " ' title= ' "+title+ " ' target=_blank class= 'line21 '> ");
out.print( " "+titleshow+ " ");
out.print( " </td> ");
}
out.print( " <td rowspan= '2 '> <div style= 'float:right; '> ");
out.print( " <table border= '1 ' width= '205 '> <tr> <td> ");
out.print( " <img src= 'images/tk9.gif ' width= '90 ' height= '90 ' align= 'center '> </td> </tr> ");
out.print( " <tr> <td> ");
out.print( "选购建材选购建材选购建材 </td> </tr> </table> </div> ");
out.print( " </a> </td> </tr> </table> ");
}
[解决办法]
基础的基础! 顶