There are only two ways I can see that you can get a ClassCastException:
1) There is some class loader magic going on. Highly unlikely.
2) You're being done in by the BoundCompoundPropertyModel you have in the
item. Fire up the debugger and check the values directly (relying on
toString() is bad; some object might be lying to you. Step into the
item.getModelObject().
Thomas
On Fri, May 30, 2008 at 5:38 PM, David Nedrow <[EMAIL PROTECTED]> wrote:
>
> On May 30, 2008, at 11:20 AM, James Carman wrote:
>
> What is the type of item.getModelObject(). Have you run it through a
>> debugger (or just simply put in a println)?
>>
>
> Yes, I had done that first, thinking maybe I didn't understand how ListView
> worked via the Model.
>
> The object returned by item.getModelObject().toString() is...
>
> com.vzbi.ncs.argfrp.jpa.netconf.Protocol
>
> That's what baffles me about the cast exception.
>
>
>
> 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]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>