#foreach($!obj in $!tables)
<tr>
#if( "$!obj.name" == "ga_dtbz" )
#set($obj.description = $descriptionList[0])
#elseif( "$!obj.name" == "ga_heaj" )
#set($obj.description = $descriptionList[1])
#elseif( "$!obj.name" == "ga_hexs" )
#set($obj.description = $descriptionList[2])
#elseif( "$!obj.name" == "ga_xsaj" )
#set($obj.description = $descriptionList[3])
#elseif( "$!obj.name" == "ga_zlaj" )
#set($obj.description = $descriptionList[4])
#end
<td>$!obj.name</td>
<td>$!obj.schema</td>
<td>$!obj.catalog</td>
<td>$!obj.description</td>
</tr>
#end
tables是request域里面装了很多表table的对象,foreach用来遍历它,velocity在使用变量的时候,在变量前面加上一个$,!表示当变量为空时不显示。 "$!obj.name" == "ga_dtbz"的意思是判断obj.name的值是不是ga_dtbz,注意都要加一个"",#set()是velocity里面的赋值语句。descriptionList是我后台传到request域的链表,$descriptionList[4]表示取链表里的第5个值。