[sourcecode language="xml"]
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<t:grid t:source="listbarang"/>
</html>
[/sourcecode]
Sedangkan untuk halaman .java
[sourcecode language="java"]
package com.example.tutorial.pages;
import java.util.ArrayList;
import java.util.List;
import com.example.tutorial.entities.Barang;
public class VariasiKomponen {
private List listBarang;
public List getListBarang(){
listBarang = new ArrayList();
listBarang.add(new Barang("1", "Lifebouyz", "Rp 2300"));
listBarang.add(new Barang("2", "Shinzuis", "Rp 3500"));
listBarang.add(new Barang("3", "Pepcodent", "Rp 3500"));
listBarang.add(new Barang("4", "Clearz", "Rp 7500"));
return listBarang;
}
}
[/sourcecode]
No comments:
Post a Comment