One. Traverse a map type
1. Read the background Java program first
Java code
Map<String,string>Paramvalues=New HashMap<string, string>();
***
* * * the intermediate assignment operation omitted
***
Data.put ("paramvalues", paramvalues); pass the value to velocity
2. Remove the key and value of this map from the foreground velocity template file
Java code
#foreach ($param in ${paramvalues.keyset ()})
<Tr>
<th> $param </th>< Span style= "color: #000000;" >
<td></td>
</tr>&NBSP;&NBSP;
#end
Two. Traversing the list type
1. Read the background Java code First
Java code
List<Saler>Salerlist=new arraylist< Span style= "color: #000000;" ><saler> ();
***
*** Middle assignment operation omitted
***
data.put ( Salerlist "
2. See the code in the Velocity template again
#foreach ($sal in ${salerlist}) $sal. Name #end
Transferred from: http://www.cnblogs.com/likwo/archive/2010/11/25/1887964.html
"Go" velocity shows the list and map methods