One. Traverse a map type
1. Read the background Java program first
Java code
Map<string,string> paramvalues=new hashmap<string, string> ();
***
The middle 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>
<td>${paramvalues.get ($param)}</td>
</tr>
#end
Two. Traversing the List type <List<VO> and list<map<string,object>>>
1. Read the background Java code First
Java code
List<saler> salerlist=new arraylist<saler> ();
***
The middle assignment operation omitted
***
Data.put ("Salerlist", salerlist);//pass the value to velocity
2. See the code in the Velocity template again
#foreach ($sal in ${salerlist})
$sal. Name
#end
Velocity shows the list and map methods