我有这些文件,我想在列表中显示数据。
package com.person.info;
public class Person {
private int id;
private String name;
private String address;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Person(int id, String name, String address) {
super();
this.id = id;
this.name = name;
this.address = address;
}
}
package com.person.info;
import java.util.ArrayList;
import java.util.List;
public class PersonDataProvider {
public static List<Person> getPerson() {
List<Person> person=new ArrayList<Person>();
person.add( new Person(1,"Prabin","Thimi"));
person.add( new Person(2,"Rabin","Bhaktapur"));
return person;
}
}
package com.person.info;
import java.util.List;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
public class PersonController extends SelectorComposer<Component> {
/**
*
*/
private static final long serialVersionUID = 1L;
List<Person> person = PersonDataProvider.getPerson();
public List<Person> getPerson()
{
return person;
}
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal" apply="com.person.info.PersonController">
<listbox model="${$composer.person}">
<listhead>
<listheader label="ID" sort="auto" />
<listheader label="Name" sort="auto" />
<listheader label="Address" sort="auto" />
</listhead>
<template name="model">
<listitem>
<listcell label="${each.id}" />
<listcell label="${each.name}" />
<listcell label="${each.address}" />
</listitem>
</template>
</listbox>
</window>
</zk>