Null value in moel of dropdown

13 views
Skip to first unread message

Tarun

unread,
Aug 11, 2011, 9:25:43 AM8/11/11
to visural-wicket
Hey,

I want to use dropdown in my application as done in examples of
cisural wicket and i am using following code for this
DropDownDataSource<User> userDS = new DropDownDataSource<User>() {
public String getName() {
return "users";
}
public List<User> getValues() {
return userDao.getAllUsers();
}

public String getDescriptionForValue(User t) {
return t.getName();
}
};
final Model basicModel = new Model(null);
DropDown assignToSelect = new DropDown("basic", basicModel,
userDS, true);
add(assignToSelect.setCharacterWidth(50));
add(new Label("basicVal", new AbstractReadOnlyModel() {
private static final long serialVersionUID = 1L;

@Override
public Object getObject() {
if (basicModel.getObject() == null) {
return "null";
} else {
return basicModel.getObject().toString();
}
}
}));



But on UI instead of seeing dropdown, i see the following
Assignt to :
[Model value = 'null']

It is clear that model value remains null thus it shows null but how
it should be solved. please help.. need very urgent..

Thanks in advance


Richard Nichols

unread,
Aug 22, 2011, 11:45:45 PM8/22/11
to visural-wicket
Your example looks like it should work.

Are you sure your form is submitting successfully?
Reply all
Reply to author
Forward
0 new messages