First look at the simple
Map<integer, string> map = new Hashmap<integer, string> ();
Map.put ("id", "value");
Model.addattribute ("map", map);
Traverse
<c:foreach items= "${map}" var= "entry" >
<option value= "${entry.key}" >${entry.value}</option>
</c:forEach>
Take a look at the code to make it harder value for list collection
This object has two properties one is a string and the other is a collection
We're going to create a
list<productproperty> pplist = new arraylist<productproperty> ();
This collection of LST is a collection of nested sets. Let's see the Traverse ...
list<productattributemetaentity> pamlist = new arraylist<productattributemetaentity> ();
Pamlist = Productattributemetaservice.querybychannel ("Old Wine Channel");
for (int i = 0; i < pamlist.size (); i++) {
Productproperty pp = new Productproperty ();
list<string> ls = new arraylist<string> ();
String values = Pamlist.get (i). GetValues ();
string[] str = values.split (",");
for (int j = 0; J < Str.length; J + +) {
Ls.add (Str[j]);
}
Pp.setkey (Pamlist.get (i). GetProperty ());
Pp.setvaluelist (LS);
Pplist.add (PP);
}
Model.addattribute ("Pplist", pplist); Statement I'm using the SPRINGMVC framework
See page traversal
<c:foreach items= "${pplist}" var= "var" >
<li class= "Clearfix" >
<div class= "label" >${var.key}:</div>
<c:set value= "${var.valuelist}" var= "Var2"/>
<div class= "Filter-list more-hiden" id= "" >
<c:foreach items= "${var2}" var= "Var3" >
<a href= "javascript:void (0);" Id= "onclick=" searchpropery (this); " >${var3}</a>
</c:forEach>
</div>
</li>
</c:forEach>
Database
To display the effect