C Tag Traversal collection nested list collection

Source: Internet
Author: User

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








Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.