What is the type of item.getModelObject(). Have you run it through a debugger (or just simply put in a println)?
On Fri, May 30, 2008 at 11:16 AM, David Nedrow <[EMAIL PROTECTED]> wrote: > I'm getting a cast exception when I attempt to pull a list element from the > model. I may be mishandling how I'm using the model, but this is basically > based on several tutorials I've looked at. > > (Note, as people have pointed out here, I use the "old fashioned" naming > style for my interfaces and DAOs.) > > Anyone see a problem with the below code? > > public class ShowProtocolsPanel extends Panel { > @SpringBean(name="ProtocolDAO") > private IProtocolDAO dao; > > public ShowProtocolsPanel(String id) { > super(id); > > IModel protocolsModel = new LoadableDetachableModel() { > protected Object load() { > return dao.findAll(); > } > }; > > add(new PropertyListView("eachItem", protocolsModel) { > @Override > protected void populateItem(ListItem item) { > Protocol protocol = (Protocol) item.getModelObject(); > > item.add(new Label("keyword", protocol.getKeyword())); > item.add(new Label("description", > protocol.getDescription())); > } > }); > } > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]