On 2/10/06,
Igor Vaynberg <[EMAIL PROTECTED]> wrote:
and if it is, looks like whatever list is returned is not serializable so wicket cannot wrap it with a model for you.
here is how to fix that and make the model detacahable, which is good anyways:
IModel listModel=new LoadableDetachableModel() {
Object load() {
//get default directory
Directory ed = DirectoryProxy.getDefaultWithEmployees();
//get employees from directory
return ed.getEmployees();
}
}
add(new ListView("emoloyees", listModel)...
-Igor
On 2/10/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:is that the root cause of the exception?
-IgorOn 2/10/06, VGJ < [EMAIL PROTECTED]> wrote:I'm trying to convert a single page of an existing application using Wicket...just to see how it works. The entire app was built on JDK 5.0. It uses hibernate and retrieves lists of data with generics...and it may be what is causing my problems since I've spotted a comment here and there that Wicket doesn't support Java 5?
It's a simple test...I've got my 3 files:
CheckIn.html
CheckIn.java
CheckInApp.java
Here's where I'm pulling a List from a proxy class in the middle-layer of the application and trying to display it:
public class CheckIn extends WebPage
{
public CheckIn()
{
//get default directory
Directory ed = DirectoryProxy.getDefaultWithEmployees();
//get employees from directory
List<Employee> employees = ed.getEmployees();
//list 1
add(new ListView("employees", empList)
{
// This method is called for each 'entry' in the list.
protected void populateItem(ListItem item)
{
//get employee object
Employee employee = (Employee)item.getModelObject();
//other employee labels
item.add(new Label("firstName", employee.getFirstName()));
item.add(new Label("lastName", employee.getLastName()));
}
});
}
}
Here's part of the exception I'm getting:
...
14:25:09,613 ERROR RequestCycle:785 - Unexpected runtime exception [page = null]
java.lang.ClassCastException: java.util.RandomAccessSubList
at wicket.markup.html.list.ListView.<init>(ListView.java:135)
at com.portlets.ui.CheckIn$1.<init>(CheckIn.java:58)
at com.portlets.ui.CheckIn.<init>(CheckIn.java:55)
Any ideas? Thanks!
