velocity实现将Collection按table输出

类别:Java 点击:0 评论:0 推荐:

<table width="550" border="0" align="left" cellpadding="0" cellspacing="0">
   #set($column=4)
   #set($flag=1)
   #set($size=$allType.get($bigTypeInfo).size())
   #set($offset=1)
   #foreach($miniTypeInfo in $allType.get($bigTypeInfo))  
    #if($flag == 1) 
              <tr align="left">              
    #end
    #if($flag <= $column) 
                <td align="left" width="100">
                  <input name="checkbox" type="checkbox" value="checkbox">
                  <a href="customize_1.htm" class="dh3">$miniTypeInfo.name</a></td>
    #end
     <!-- 补空行 -->
     #if($offset == $size)
      #set($mod = $size % $column)
     #if($mod != 0)
      #set($mod = $column - $mod)
     
       #foreach( $bar in [1..$mod] )
       <td align="left" width="100"></td>
      #end     
     #end
     #end
     <!-- end补空行 -->
    #if($flag == $column)  
     
      
      
                </tr>
      #end

     #set($flag=$flag+1)
     #set($offset=$offset+1)
     #if($flag==$column+1)
      #set($flag=1)
     #end
   #end
            </table>

本文地址:http://com.8s8s.com/it/it14097.htm