Hello Wicket Users and thanks in advance for any help,
I am attempting to write my first wicket application by modifying the
GuestBook application. I replaced the Comment class with my own class called
arDetails. My application compiles and the first page loads normally when run
in Jetty. However when I submit a guestbook comment, I get this originating
error in the stack trace:
...
java.lang.ClassCastException: wicket.examples.guestbook.Comment cannot be cast
to wicket.examples.guestbook.arDetails
at wicket.examples.guestbook.GuestBook$1.populateItem(GuestBook.java:583)
...
Here is the code:
add(new CommentForm("commentForm"));
add(commentListView = new ListView("comments", commentList)
{
public void populateItem(final ListItem listItem)
{
line 583:-> final arDetails ard = (arDetails)listItem.getModelObject();
listItem.add(new Label("text", ard.getName()));
}
});
}
commentListView and commentList don't appear to be cast to anything before the
(arDetails) cast, let alone the Comment class. Here is where they are defined:
line 31:-> private static final List commentList = new Vector();
line 32:-> private final ListView commentListView;
This is the original GuestBook code:
add(new CommentForm("commentForm"));
add(commentListView = new ListView("comments", commentList)
{
public void populateItem(final ListItem listItem)
{
final Comment comment =(Comment)listItem.getModelObject();
listItem.add(new Label("date", comment.date.toString()));
listItem.add(new MultiLineLabel("text", comment.text));
}
});
}
What am I not seeing?
Thanks,
Joe