Ah, yes - sorry I missed it. There are a couple of errors. 1 - change your Cheese cheese = (Cheese) line (see below) 2 - change getDefaultModel to getModel - the generic version of the method
public Index() { add(new ListView<Cheese>("cheeses", getCheeses()) { private static final long serialVersionUID = -6160450216067455300L; @Override protected void populateItem(ListItem<Cheese> item) { Cheese cheese = item.getModelObject(); item.add(new Label("name", cheese.getName())); item.add(new Label("description", cheese.getDescription())); item.add(new Label("price", "$" + cheese.getName())); item.add(new Link<Cheese>("add", item.getModel()) { private static final long serialVersionUID = 3724016761964076585L; @Override public void onClick() { Cheese selected = getModelObject(); getCart().getCheeses().add(selected); } }); } }); } -- Jeremy Thomerson http://www.wickettraining.com On Thu, Oct 15, 2009 at 5:17 PM, Andrig T. Miller <andrig.t.mil...@gmail.com > wrote: > > public Index() { > > add(new ListView<Cheese>("cheeses", getCheeses()) { > > private static final long serialVersionUID = > -6160450216067455300L; > > @Override > protected void populateItem(ListItem<Cheese> item) { > > Cheese cheese = (Cheese) > getDefaultModelObject(); > > item.add(new Label("name", > cheese.getName())); > item.add(new Label("description", > cheese.getDescription())); > item.add(new Label("price", "$" + > cheese.getPrice())); > item.add(new Link<Cheese>("add", > item.getDefaultModel()) { > > private static final long > serialVersionUID = 3724016761964076585L; > > @Override > public void onClick() { > > Cheese selected = (Cheese) > getDefaultModelObject(); > > getCart().getCheeses().add(selected); > > } > }); > } > }); > > }