Just a quick tip that I didn’t realise I could do , if say you can an Entity:
public class Person {
String name;
List emails;
}
public class Email {
String email;
}
Say for whatever reason I only want to show the first email in the list you can do the following using a CompoundPropertyModel :
...
setModel(new CompoundPropertyModel
(person);
add(new Label("name"));
add(new Label("email", new PropertyModel(item.getModel(), "emails[0].email")));
Notice the syntax for the PropertyModel and how you get directly index the list:
emails[0].email
. Wicket is smart enough to take care of nulls, which is why wicket is wicked.







0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.