Book book = (Book) item.getModelObject();
item.add(new Radio("radio", item.getModel()));
notice you are giving the radiochoice a model of the item not the model object [[book]]. is your model detachable, can it reload itself? because at the end of the request it will be detached and if it cannot reload itself when the onsubmit is processed the model object it will return will be null.
-Igor
On 6/19/06, R.A <[EMAIL PROTECTED]> wrote:
Hi.
I create Form and RadioGroup.
MyPage class
Form form = new Form("form");
add(form);
final RadioGroup radioGroup = new RadioGroup("radioGroup", new Model());
form.add(radioGroup);
radioGroup.add(new MyDataView(new MyDataProvider()));
form.add(new Button("button") {
protected void onSubmit() {
Book book = (Book) radioGroup.getModelObject();
String title = book.getTitle();
}
});
MyDataView class
protected void populateItem(final Item item) {
Book book = (Book) item.getModelObject();
item.add(new Radio("radio", item.getModel ()));
item.add(new Label("title", book.getTitle());
}
RadioGroup and its radio items(radio and title) output normally.
But when submit button is clicked, NullPointerException occur.
Book book = (Book) radioGroup.getModelObject();
This "book" object is null.
When adding ListView (not DataView) on RadioGroup, work fine.
What's wrong?
I use Wicket 1.2.
Regards,
R.A
--
View this message in context: http://www.nabble.com/RadioGroup-and-DataView-t1810187.html#a4933188
Sent from the Wicket - User forum at Nabble.com .
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
